How to convert DjVu to PDF using Foxit Reader

There are several ways to convert DjVu file to PDF. All these methods result in PDF file sizes that are quite large, in hundreds of MBs. I have found that the converting using Foxit Reader results in the smallest PDF file sizes.

To do this:

  • Install the free Foxit Reader from here. This also installs a PDF Printer which we will use for conversion.

  • Install any DjVu viewer. I use WinDjView from here.

  • Open the DjVu file in WinDjView. Choose to print it. In the printer list, choose Foxit Reader PDF Printer. This printer has settings that you can modify. For the print settings, choose a page size (Letter) and remember to choose Scale to fit media. This will use the Foxit PDF Printer to write a PDF file for you.

  • Note that the settings of the Foxit Reader PDF Printer did not seem to have much effect on the file size. Default is 600 DPI. I did not see much reduction in filesize by using 300 or 200 DPI.

  • Note that the resulting PDF does not have OCR. You would need to run it through a OCR tool to get text embedded in the PDF.

Tried with: Foxit Reader 7.2.8.1124, WinDjView 2.1 and Windows 10

Advertisements

How to annotate documents using Okular

Okular is not only a great viewer for documents, but it can also be used to annotate and take notes on these documents. This is typically used with PDF documents.

  • If you want to work with DjVu and other formats, remember to install those backends:
$ sudo apt install okular-extra-backends
  • To annotate, open the document and choose Tools -> Review. The keyboard shortcut for this is F6.

  • A sidebar appears with buttons to add popup notes, freehand, highlight and other operations.

  • Single-click on any of these buttons, to be able to perform that operation once. To perform it again, you will need to click the button again.

  • Double-click on any of these buttons, to be able to perform that operation multiple times. Press Esc to disable the operation after you are done.

  • To edit the color, thickness or any other property of these annotation tools, right-click anywhere in the sidebar and choose Configure Annotations.

  • To remove any annotation (even from a PDF file), right-click on it and choose Delete.

  • To move annotations such as popup notes, hold Ctrl key while you click and drag them with the mouse.

  • By default, the annotations are saved locally in a hidden file in the home directory.

  • To save the annotations along with the file, save it as a Okular document archive. To do this, choose File -> Export as -> Document Archive. This is typically saved with the file extension .okular.

Reference: Annotations documentation page about Okular

Tried with: Okular 4.13.3 and Ubuntu 14.04

How to convert PDF to DJVU

If you have created a PDF file by scanning documents, then DJVU might be a better format for that. Converting a PDF file to DJVU is easy on Ubuntu.

Install the pdf2djvu package:

$ sudo apt install pdf2djvu

To convert a PDF file to DJVU:

$ pdf2djvu foo.pdf -o foo.djvu

Tried with: PDF2DJVU 0.7.17 and Ubuntu 14.04

How to perform OCR on a DJVU document

OCR on DJVU using CuneiDjVu

A DJVU document typically contains both a layer of scanned image and a layer of the text in that image. Sometimes, a DJVU document is produced which does not have the text layer. This makes it hard to search and find text in the document.

Recognising the text in the DJVU document using OCR and adding that as a text layer to that document is easy:

  1. Download CuneiDjVu and unzip its contents.
  2. Run the CuneiDjVu program.
  3. Choose the DJVU document as input, choose the output folder and the OCR language.
  4. Press Process and the resulting file will beΒ CuneiDjVu Result.djvu on your Desktop.

Tried with: CuneiDjVu 1.4 and Windows 7 Professional x64

How to convert DJVU to PDF

DjVuLibre provides open source libraries, commandline tools and GUI tools for dealing with DJVU files. So all solutions for converting a DJVU file to a PDF file will use DjVuLibre is some form. Note that it looks like all conversion options seem to produce PDF by converting every DJVU page into an image. So, the resulting PDF files will be big and much larger than the original DJVU files. There seems to be no way to produce smaller PDF files.

Using ddjvu

  • Install DjVuLibre tools on Ubuntu:
$ sudo apt install djvulibre-bin
  • Convert using the ddjvu tool:
$ ddjvu -format=pdf in.djvu out.pdf

Tried with: Ubuntu 18.04

Using djvups

  • Install DjVuLibre and Ghostscript tools on Ubuntu:
$ sudo apt install djvulibre-bin ghostscript
  • Convert DJVU to Postscript:
$ djvups in.djvu out.ps
  • Convert PS to PDF:
$ ps2pdf out.ps out.pdf

Tried with: Ubuntu 18.04

Using DJView

Export DJVU as PDF in DJView

To convert a DJVU document to a PDF document:

  1. Install DjVuLibre DJView.
  2. Open the DJVU document in DJView.
  3. Choose File β†’ Export as
  4. In the Export dialog choose PDF document, the PDF filename and path and press OK.

Note that the PDF export option seems to be missing in recent versions of DJView.

Tried with: DjVuLibre DJView 4.9 and Windows 7 Professional x64

Delete pages from a DjVu document

Deleting one or more pages from a DjVu document can be done using the DjVuΒ multipage document manipulation utility. This is the executable djvm.exe that ships with the DjVuLibre package.

The -d option can be used to delete a single page from the document. However, djvm does not accept multiple pages or a range of pages to delete. To achieve this, invoke djvm multiple times using the looping features of your shell. The example below is for PowerShell.

Tried with: DjVuLibre 3.5.25.3