Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc



Several file formats have been used in the last years for the storage and distribution of documents in electronic format. It's well known that vectorial formats are the best choice for computer-generated documents (e.g. a dvips-produced postscript file). For the documents which are not available in vectorial form, the most widely known example being scanned documents, a non-vecotrial format is used. It's common to see books and single-page scans being provided in jpeg format (or in some strange format or combination), but that has the dark side of the space needed to store documents with an acceptable quality level.


DjVu (déjà vu) is a format designed for scanned documents. It solves the size vs. quality issue by providing high quality at very low file sizes, supporting also a (OCRed) text layer.

Being initially developed at AT&T, a commercial version of tools is maintained today by LizardTech, but the file format itself is open - specifications were published. GPLed tools are also maintained by the original authors of DjVu, under the name of "DjVuLibre".

Deeper technical information is also available, see the Downloads and Resources secton at


To install a set of tools to manipulate and visualize DjVu documents, compile the app-text/djvu package:

# emerge app-text/djvu

Viewing documents

A good way to start playing with DjVu is to pick a file from the preoviously mentioned Downloads and Resources section of and open it using djview.

$ wget
$ djview 2002_electronic_publishing.djvu

Generating documents

There are two ways of generating DjVu documents. One is using local tools to do the conversion locally. This is not (yet) covered by this guide. The other way is to use a script provided with the tools, any2djvu, which will upload the original file and ask a server to generate a djvu version of the document.

As with any other application, the manpage is a good starting point:

$ man any2djvu

For a quick start, here is the syntax:

 any2djvu [options] [url] {filename(s)}

If you want to convert a file named document, check the supported formats:

$ any2djvu -f help

This will output a numbered list. If the document is a scanned one (jpeg, e.g.), 300 dpi coloured, the number you want is 8.

So you will need to run:

$ any2djvu -f 8 document

This will generate two documents (be patient, it may take some seconds), document.djvu, that's what you want, the DjVu-encoded version of document, and document.log, a copy of the output from any2djvu.

Multipage documents

any2djvu allows you to convert several documents with one command, but at the end you will have one djvu per document. You may wish documents to be collected into one file, this way an article may be distributed and viewed using only one file. Same goes for books.

The application responsible for joining the pieces and creating the multipage document is djvm. Having a clear manpage, you can look at it to see what it does.

For creating a bundled document, use the "-c" option:

$ djvm -c book.djvu page.djvu anotherpage.djvu

And book.djvu will be created, and filled with the contents of page.djvu and anotherpage.djvu. You can bundle as many documents as you want, just include their names after the name of the file you want to create (which is book.djvu, in this example).

Going further

Evince with djvu

If you build evince with the djvu useflag enabled, it will be able to read djvu files.

Other operating systems

There are DjVu webbrowser plugins for Windows and other operating systems, available from LizardTech. They work with Firefox and Safari.

This is useful when you want to give your DjVu document to a friend who is using some different operating system where DjVuLibre does not work, it's not for yourself (DjVuLivre (app-text/djvu) already includes a webbrowser plugin).

Retrieved from ""

Last modified: Fri, 05 Sep 2008 03:50:00 +0000 Hits: 3,592