Skip to content

Instantly share code, notes, and snippets.

@jdrew1303
Forked from yakovsh/2007_07_25-djvu2pdf.sh
Created March 20, 2021 22:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jdrew1303/37f50af64c5a4bf1b16478500cd66cfe to your computer and use it in GitHub Desktop.
Save jdrew1303/37f50af64c5a4bf1b16478500cd66cfe to your computer and use it in GitHub Desktop.
Converting from DJVU to PDF
#!/bin/sh
#
# Here is the software that is needed for the conversion to take place:
# 1. DjVuLibre .
# 2. LibTiff .
#
# NOTE: The ddjvu utility has an option to convert specific layers. One common mistake is to convert only the mask layer
# or the foreground layer . Technically speaking, the mask layer is the one that should have the actual text but in
# practice I have seen that the the DjVu encoder occasionally puts portions of the text in the background layer. Thus,
# if you only take the foreground or mask layers, you will lose those bits in the background. If your specific files
# don't have that issue, that you should use the layer switch since it reduces file size and increases readibility.
#
djvu -verbose -format=tif %1 temp.tif
tiff2pdf temp.tif -o %2
rm temp.tif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment