Home » Questions » Computers [ Ask a new question ]

How do I convert a DjVu document to PDF in Linux using only command line tools?

How do I convert a DjVu document to PDF in Linux using only command line tools?

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?

Asked by: Guest | Views: 58
Total answers/comments: 4
Guest [Entry]

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.
Guest [Entry]

"What about simply using DJView and export as PDF?

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

Look at http://art.ubuntuforumsdotorg/showthread.php?t=1232038"
Guest [Entry]

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

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

mode='color'
quality=80

aparse() {
while [ $# != 0 ] ; do
case ""$1"" in
-q|--quality)
quality=${2}
shift
;;
-b|--black)
mode='black'
;;
esac
shift
done
}
aparse ""$@""

i=""$1""
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;;
esac
fi
echo ""[ converting $i to $o ] ""

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

echo ""[ executing $cmd ] ""
$cmd"
"I've changed the @Maxim script a little ...

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

mode='color'
quality=80

aparse() {
while [ $# != 0 ] ; do
case ""$1"" in
-q|--quality)
quality=${2}
shift
;;
-b|--black)
mode='black'
;;
esac
shift
done
}
aparse ""$@""

i=""$1""
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;;
esac
fi
echo ""[ converting $i to $o ] ""

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

echo ""[ executing $cmd ] ""
$cmd"
Guest [Entry]

"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"