(Last Updated On: January 26, 2019)

Are you looking for a way to convert an EPUB format file to a PDF file on the Linux command line interface?. EPUB is an e-book file format that uses the “.epub” file extension. Even though the ePub format is supported by most E-Readers installable on Windows, Smartphones, Tablets, e.t.c., you could still have a need to convert EPUB to PDF format which is commonly used.

In this guide, I’ll show you the easiest and safest way of converting ePub files to PDF. This is possible with the help of Calibre. This software is not pre-installed on most Linux distributions but it can be easily installed using the OS package manager.

Install Calibre on Debian / Ubuntu

For Ubuntu / Debian family of Linux, install Calibre by running the command below:

sudo apt-get -y install calibre

Installation of Calibre provides ebook-convert command which we’ll use for the actual conversion.

$ which ebook-convert
/usr/bin/ebook-convert

Install Calibre on Arch Linux / Manjaro

The Calibre package is available on Arch Linux upstream repository. Install it by running:

sudo pacman -S calibre

Install Calibre on CentOS / Fedora

Calibre has a binary install that includes private versions of all its dependencies. Execute command below in your terminal to install Calibre on CentOS / Fedora.

sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin

This requires wget. If not installed, first install it:

# CentOS 
sudo yum -y install wget

# Fedora
sudo dnf -y install wget

How to Convert ePub file to PDF Format on Linux CLI

Now that you have installed Calibre, you can start the conversion process. Change your current working directory to folder container EPUB file.

$ cd ~/ebooks

The convert the ePub file to PDF using the command:

ebook-convert <file>.epub <file>.pdf

See example below:

$ ebook-convert myfile.epub myfile.pdf

Confirm file type.

$ file myfile.pdf
myfile.pdf: PDF document, version 1.4

Try to open your PDF and see if readable. If the output is not appealing, then try:

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

You can also do the conversion from the Calibre GUI.