Abstract
This paper introduces a method for bringing the high-efficiency compression of the DjVu format—originally designed for scanned paper—to purely electronic documents such as PDFs and Word files. By utilizing a "Virtual Printer Driver" (VPD) to intercept Enhanced Metafile (EMF) print commands, the system segments documents into intelligent layers: a high-resolution bitonal foreground for text, a lower-resolution wavelet-compressed background for images, and a hidden text layer for searchability. Experimental results demonstrate file size reductions ranging from 2x to 50x compared to standard formats, while maintaining visual fidelity and enabling progressive rendering for web distribution.
Introduction
In the early 2000s, sharing high-quality color documents over the internet presented a significant challenge. Standard image formats like JPEG were optimized for photographs but produced noticeable artifacts around text, while bitonal formats preserved text sharpness at the cost of all color and texture. While the DjVu format had already addressed these issues for scanned documents, electronic documents (e.g., PDF, PostScript) remained bulky and platform-dependent. This research sought a universal method to convert any electronic document into a highly compressed, web-friendly DjVu file without sacrificing searchability or detail.
The DjVu Virtual Printer Driver
The core of the proposed solution is the DjVu Virtual Printer Driver (VPD), which acts as a universal converter by appearing as a standard printer to the operating system.
Instead of capturing raw pixels, the VPD intercepts Windows Enhanced Metafile (EMF) records. These records contain the low-level drawing commands—such as character placement and line drawing—sent by an application to the printer subsystem. By working with these structured commands, the converter preserves the original "intent" of the document, allowing for perfect text extraction without the need for Optical Character Recognition (OCR).
Layered Segmentation and Compression
DjVu achieves its efficiency by segmenting each page into three distinct layers, each compressed using specialized algorithms:
- Background Layer: Contains textures and pictures at a lower resolution (typically 100 dpi), compressed using IW44, a wavelet-based method.
- Foreground Layer: A high-resolution (300–600 dpi) bitonal "mask" for text and line art, compressed using JB2. This algorithm uses shape clustering to store a single "prototype" for recurring characters (like the letter 'e'), significantly reducing redundancy.
- Hidden Text Layer: Stores the actual text characters and their coordinates to enable full-text searching and indexing.
To determine the optimal segmentation between the background and foreground, the authors employ the Minimum Description Length (MDL) principle, choosing the configuration that results in the smallest total bitstream.
Results and Performance
The system was evaluated on a variety of real-world documents, including complex PDF layouts (NY Times, HBS Review), high-detail vector maps, and web page captures. The quantitative results showed massive efficiency gains:
- Vector Map: Reduced from 1.67 MB (PDF) to 117 KB (DjVu), a nearly 15x reduction.
- Magazine Layouts: The 92-page NY Times PDF was reduced from 25.9 MB to 8.57 MB.
- Progressive Rendering: Because the text layer is extremely small, it can be transmitted and rendered first, allowing users on slow connections to read the document almost immediately while the background progressively "fades in."
Conclusion
While the current implementation is tied to the Windows GDI architecture and is a raster-based format requiring a pre-selected resolution, it offers a powerful solution for electronic publishing. By leveraging structured printer commands and intelligent layered segmentation, the DjVu VPD provides a highly efficient, searchable, and platform-independent way to distribute complex color documents over the web.
Summary updated