I've got some documents in DjVu which I'll like convert to PDF. Is there a way to do this using command line OSS tools?

7 Answers 7


djvu2pdf should fit the bill, it's a small script that makes use of the djvulibre toolset. If not, there are other methods that require multiple command-line tools.

  • What's a pity that, currently there is not djvu2pdf tool in Arch repo and old ver in Arch User repo Nov 2, 2011 at 17:42
  • 1
    Installing djvulibre-bin using apt-get and then installing the deb file in that link did the trick.
    – thameera
    Apr 21, 2014 at 10:27
  • 1
    On mac you djvu2pdf is available via MacPorts.
    – 0 _
    Jul 2, 2014 at 7:59
  • 6
    Mac users can also run brew install djvu2pdf to install the program and djvu2pdf file.djvu to convert. Homebrew takes care of downloading all its dependencies
    – Lxrd-AJ
    Apr 24, 2020 at 11:26
  • 1
    djvu2pdf works although it produces a slightly bigger file than ddjvu with compression enabled. Other issue is that it doesn't copy the table of contents of the source document.
    – Grwlf
    May 1, 2022 at 11:00

The ddjvu program (which is part of the standard djvulibre package) will do this:

$ ddjvu -format=pdf -quality=85 -verbose a.djvu a.pdf

Warning: this produces large files (but PDF files made by Christoph Sieghart's script are of the same size).

I also wrote the following small shell script some years ago.  It does the same automatically. (Save this as djvu2pdf.sh.)


# convert DjVu -> PDF
# usage:  djvu2pdf.sh  <file.djvu>

echo "------------ converting $i to PDF ----------------";
o="$(basename "$i" .djvu).pdf"
echo "[ writing output to $o ] "

ddjvu -format=pdf -quality=85 -verbose "$i" "$o"

The djvu2pdf script by Christoph Sieghart does essentially the same.

  • 5
    Is there a way to make OCR layer of the DjVu come through into the PDF?
    – Geremia
    Feb 25, 2017 at 4:09
  • 1
    using ddjvu turned my 6.3 mb djvu file into a 1.7 gig pdf file.
    – xdavidliu
    Jun 10, 2020 at 12:52
  • something is wrong. this should not happen. you can post here the link to the file.
    – Maxim
    Jun 11, 2020 at 1:03

What about simply using DJView and export as PDF?

  1. Goto Synaptic Package Manager (System - Administration - Synaptic Package Manager)
  2. Install DJview4
  3. Run DJview (Applications - Graphics - DJView4)
  4. Open your .djvu document
  5. Menu - Export As: PDF

Look at http://art.ubuntuforums.org/showthread.php?t=1232038

  • 3
    The question was about using command line only, so this can be automated.
    – Maxim
    May 19, 2019 at 17:40
$ djvups input.djvu | ps2pdf - output.pdf

In my case the output file was 10x smaller than with ddjvu. Both djvups and ps2pdf present in ubuntu repository.

$ sudo apt-get install djvulibre-bin ghostscript

I've found this method in man ddjvu, so always read manuals ;)

An alternate way to produce PDF file consists in first using djvups(1) and convert the resulting PostScript file to PDF. Which method gives better results depends on the contents of the DJVU file and on the capabilities of the PS to PDF converter.

  • 6
    +1 for preserving any text layer in the djvu file
    – Plasma
    Apr 1, 2018 at 18:29
  • 1
    +1 for that apt command XD
    – Kokizzu
    Sep 20, 2020 at 4:47
  • This is the only one preserving the text layer. But increases filesize 10-fold for me.
    – user313032
    Nov 10, 2021 at 2:05

If you don't care about colors and images you can get much smaller files if you drop the colors and use instead:

ddjvu -format=pdf -mode=black input.djvu output.pdf

Texts, codes and formulas looks perfectly, but most of the images are gone


I've changed the @Maxim script a little ...

# convert DjVu -> PDF
# usage:  djvu2pdf.sh [-q quality | -b] <infile.djvu> [outfile.pdf]


aparse() {
  while [ $# != 0 ] ; do
    case "$1" in
aparse "$@"

o=${2:-$(basename $i .djvu).pdf}
if [ -f  "$o" ]; then 
  echo "file $o exists, override [Y/n]?"
  read ans
  case "$ans" in 
   n|N) exit 1;;
echo "[ converting $i to $o ] "

cmd="ddjvu -format=pdf -quality=$quality -mode=$mode -verbose $i $o "

echo "[ executing $cmd ] "

For MacOS users you can install djvu2pdf like this:

$brew install djvu2pdf 

How to use it(works for any Xnix like system):

$djvu2pdf nameBook.djvu nameBookToCreate.pdf

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.