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 ?
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
For this, you need to
convertis 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)
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
out.pdfwith all pages from
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.