How to Convert PDF to ePUB with Linux

In this short tutorial, we'll see how to convert easily PDF file(s) to ePUB with Linux and Calibre.

Step 1: Install calibre

Let's see how to install Calibre on Linux Mint and Ubuntu by using terminal:

sudo apt install calibre

Alternatively calibre is available from the Software Center for installation.

The installation will take about 75 MB disk space.

Step 2: Convert PDF file to ePUB

In this section, we'll see how to convert PDF file to ePUB with command - ebook-convert. For better results we will use parameter - --enable-heuristics:

ebook-convert book.pdf book.epub  --enable-heuristics

The command will convert the PDF file to ePUB page by page.

Note - command needs to be executed in the folder where the PDF files are located.

Heuristic Processing

With flag --enable-heuristics we can control the strcuture and different options. There are different flags like:

  • --disable-dehyphenate
  • --disable-delete-blank-paragraphs
  • --disable-fix-indents
  • --disable-format-scene-breaks
  • --disable-italicize-common-cases
  • --disable-markup-chapter-headings
  • --disable-renumber-headings
  • --disable-unwrap-lines
  • --html-unwrap-factor
  • --replace-scene-breaks

More information about command ebook-convert is available on this link: Calibre - ebook-convert

Step 3: Convert mulitple PDF to ePUB

Finally, let's convert multiple PDF files to ePUB with single command:

find ./ -iname "*pdf" -type f | while read f; do echo -e "\e[1mConverting file $f \e[0m" ; ebook-convert "$f" "${f%.pdf}.epub" --enable-heuristics ; done

How the command works?

  • it search for PDF files in the current folder
  • it prints out the file name
    • Converting file ./book1.pdf
  • start conversion with option --enable-heuristics

Conclusion

In this article we saw how to convert single or multiple PDF files to ePUB with calibre and Linux Mint.