Convert an EPUB ebook to PDF from the command line with Calibre's ebook-convert tool. The basic form is one command; extra flags tighten the output into a denser, textbook-style layout.
Install Calibre
Calibre is in the official extra repo, so no AUR is needed.
sudo pacman -S --needed calibreBasic conversion
Ebook filenames often contain spaces. Change into the folder first and use a *.epub glob so the shell fills in the exact name, which avoids typos and line-break issues.
cd ~/Downloads/book-to-convert
ebook-convert *.epub 'output-name.pdf'If you prefer to type the source name, start with ebook-convert 'Prob and press Tab for shell completion.
Denser textbook-style output
Calibre's PDF stage defaults to a large base font (around 20pt), which makes the output read like a blog post. Shrink the fonts and margins to tighten it.
cd ~/Downloads/book-to-convert
ebook-convert *.epub 'output-dense.pdf' \
--paper-size a4 \
--pdf-default-font-size 14 \
--pdf-mono-font-size 12 \
--pdf-page-margin-top 24 --pdf-page-margin-bottom 24 \
--pdf-page-margin-left 28 --pdf-page-margin-right 28 \
--minimum-line-height 110 \
--pdf-add-tocFlags
- --paper-size a4 - page size for the output PDF
- --pdf-default-font-size - main lever for density; try 12 for tighter text
- --pdf-mono-font-size - size for code and monospace blocks
- --pdf-page-margin-top / -bottom / -left / -right - margins in points (36pt = 0.5in)
- --minimum-line-height - line height as a percent; lower is tighter
- --pdf-add-toc - adds a generated table-of-contents page (the EPUB's own TOC also becomes PDF bookmarks automatically)
What the conversion cannot reproduce
An EPUB is reflowable HTML with no fixed page layout. The original printed book's dense, multi-column layout is not stored in the EPUB, so a conversion can never reproduce it: the content reflows into single-column pages. Font and margin tuning helps, but the true original look requires the original PDF.
Log messages that are safe to ignore
These appear during conversion and are cosmetic or informational only.
Ignoring CSS rule with invalid selector ... :has(...) / ::marker ... not supported- Calibre's CSS engine skips modern selectorsThe cover image has an id != "cover". Renaming to work around bug in Nook Color- an informational workaroundGPUInfo not initialized on GpuInfoUpdate- Qt/WebEngine chatterRemoving fake margins/Cleaning up manifest/Trimming unused files- normal cleanup steps
GUI alternative
The full Calibre app can do the same conversion: add the book, choose Convert books, and set the output format to PDF. The CLI above is faster for one-offs.