4

I search a way for lossless, reliable and also compressed conversion of pdf files, which contain black and white text scans, to the djvu format. The tool must be a commandline program so I can atomize the conversion. I found that djvulibre but I was not able to make it work with the required drivers on my ubuntu linux (they seem to be separate because of license issues). pdf2djvu has options to adjust the loss level for image compression, but I am not sure if it will always detect the resolution of the source files correctly so that I am afraid that it may create loss due to resampling of the images. Any hints to other software, the resolution of driver issues with djvulibre or the proper use of pdf2djvu are very welcome.

0

1 Answer 1

4

You can use xpdf to extract the scan images from inside your PDF files
Then use imagemagick to convert each image into pbm format:

convert page-000.png page-000.pbm

Then convert your pbm images into djvu pages with djvulibre.

cjb2 -clean page-000.pbm page-000.djvu

Finally adding your new page to the final document

djvm -i page.djvu page-000.djvu

The process is partially explained here: Creating a DjVu file

3
  • Thanks! Will this procedure preserve the page size and the borders in the documents? I ask because in the PDF files the embedded images will not necessarily extend to the edges of the pages. The pdfimages manpage says that the -j option outputs PBM, so we could possibly omit the second step.
    – highsciguy
    Jun 19, 2013 at 17:55
  • I don't think it will preserve them, but cannot think on any better way of preserving the original images and create a lossless process.
    – yms
    Jun 19, 2013 at 18:03
  • Ok, then the question arises if the borders can be copied separately from the original pdf to the final djvu. Or at least I would need a way to generate djvu which has a given fixed size, say letter or A4, and to justify the pictures on the pages.
    – highsciguy
    Jun 19, 2013 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .