Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How to convert djvu2pdf ?

My current approach is :

djvups x.djvu > x.ps
ps2pdf x.ps

Is there more efficient and better (in terms of output quality, data/metadata loss) way to handle that ?

share|improve this question
1  
You can try these solutions: superuser.com/questions/100572/… –  nozimica Nov 2 '11 at 17:14
    
As I've wrote there : What's a pity that, currently there is not djvu2pdf tool in Arch repo and old ver in Arch User repo –  Grzegorz Wierzowiecki Nov 2 '11 at 17:42
    
Another way is printing djvu to pdf printer, but you'll got same commands as you tell –  Eir Nym Nov 19 '11 at 15:27
add comment

1 Answer 1

I tried printing the djvu file to PDF (using Evince, so it's probably a mix of djvulibre, gtk+ and cairo), but I got a way smaller result by converting the djvu pages to pdf using ImageMagick's convert.

For this, you need to

  1. extract each page as a separate djvu document (I'm not sure if convert is able to deal multipage djvu and multipage pdf that easily), see djvmcvt -i (an "indirect" document is a document where each page is stored in a separate djvu file)
  2. convert the page using convert — we're not losing anything here, remember that djvu is not vectorial, so even if you're generating an Adobe PDF, you're using it for a raster image
  3. join the pages in a single PDF (you can just feed them to ghostscript -- for example, generating an A4 PDF named out.pdf with all pages from *.pdf in the current directory would be gs -q -sPAPERSIZE=a4 -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf *.pdf)

This said, keep in mind that

  • This does just a straight conversion of a raster image — I guess the only thing you can tweak is the image quality, if it gets stored in the pdf using lossy compression (if convert is unable to do that, ghostscript has some options to tweak the output of pdfwrite, along the lines of -dPDFSETTINGS=, I'm not sure but these may include the possibility of enforcing lossy compression and defining the quality level)

  • This does not use djvu-specific knowledge, I guess the fact djvu encodes foreground and background separately can be used to generate the PDF in a clever way that somehow uses that to save some space

  • PDF is for vectorial stuff, djvu is way better suited for rasterized documents than PDF.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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