2

One of the (many) advantages of compressing a scanned page with DjVu is that it de-duplicates characters:

…bitonal image compression that takes advantage of repetitions of nearly identical shapes on the page (such as characters) to efficiently compress text images.

Unfortunately, the PDF export feature of DjView (and its command-line counterpart ddvju) throws away that advantage and renders a single image for each page. The result is that the PDF is usually 2 times as large as the DjVu file.

Seeing as the PDF format is more than capable of storing a picture once and displaying it many times in a page, I was wondering if there are any tools that generate an optimized PDF, preserving the DjVu compressed structure.

1

I don't know of any ways using linux, but using Windows the DjVuToy program will do exactly what you want. It keeps the layers separate and converts them individually from DjVu to a PDF equivalent. The file size will stay about the same, and the document will now be viewable using most PDF readers.

  • 1
    Awesome! That's exactly what I needed. Using DjVuToy I can convert a 27MB DjVu into a 30MB PDF of the same resolution, as opposed to the 56MB PDF created by standard DjVu tools. This is a big size difference for many users. For anybody who is wondering where to get it, go to the author's homepage, click on the sticky blog post, and follow the link to the author's shared folder on Baidu. I opened it in a VM, because that's my policy with strange software, but it works well and seems legit. – Tobia Jan 15 '18 at 10:36
0

If I understand your problem correctly, and it is a little bit vague, is that you have a number of DjVu files that you would like to convert to PDF. The DjVu's that you want to convert have been generated from a scanner and thus the underlying data format is a bitmap/raster/picture graphics type format.

You are incorrectly assuming the capabilities of the PDF format (Adobe Spec) (Wikipedia Article). The PDF format is basically a simple mark-up language that describes how to format and place text and images on a page, do basic vector drawing, and also has the ability to have picture data encoded with in it. The text and page description mark-up language is usually then encoded with either the LZW or Flate compression algorithms. The picture data is stored as either JPEG (Page 39), TIFF (Page 71) or GIF (Page 842).

The PDF format does not use any novel technology like the DjVu format (DjVu Spec) (Wikipedia Article) does. Basically DjVu scans an entire document and looks for things that it can combine together, and then leave a reference to where each object appears. The DjVu format is much more clever than PDF in this regard. In a sense the DjVu format is more similar to a JPEG than it is to PDF when you look at the how the algorithm operates across an entire multi-page document.

A PDF document created by a scanner is just a series of pages defined to be a certain size, with a JPEG pasted into each page. You could run the PDF Data through an OCR (Optical Character Recognition) process, and recreate the document in a text format, and this would hugely reduce the size of the PDF document. The PDF document does not have OCR built into the format, but some readers, such as the Adobe Reader, has built-in OCR that lets you search within a JPEG-type PDF document.

I also understand that the Adobe Acrobat does have OCR processing capability. There are other programs, OmniPage comes to mind, as well as there are a number of open source OCR systems out there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.