Turn an EPUB ebook into a PDF from the command line with
sumatrapdf-tool convert, or from SumatraPDF by printing to Microsoft Print to PDF.Use
sumatrapdf-tool convert -o book.pdf book.epub: the PDF keeps selectable, searchable text. At a glance:- Command line:
sumatrapdf-tool convert -o book.pdf book.epub— text stays text, small files, page size and font size are adjustable. Available in pre-release 3.7 - In SumatraPDF: File → Print to the Microsoft Print to PDF printer — pages become images: no text selection or search, much bigger files.
Convert from the command line #
Use
sumatrapdf-tool.exe convert, or SumatraPDF.exe convert with the same arguments:sumatrapdf-tool convert -o book.pdf book.epub
The book is laid out into pages of 420 x 595 points (about A5) by default. Change the layout with:
| Option | Meaning |
|---|---|
-W <n> |
page width in points (72 points = 1 inch) |
-H <n> |
page height in points |
-S <n> |
font size in points |
-U <css> |
file name of a user stylesheet applied to the book |
-X |
ignore the book’s own styles |
A4 pages with 12 pt text:
sumatrapdf-tool convert -W 595 -H 842 -S 12 -o book.pdf book.epub
US Letter is
-W 612 -H 792.Add a page range after the file name to convert only part of the book:
sumatrapdf-tool convert -o start.pdf book.epub 1-20.More options: sumatrapdf-tool convert.
Convert in SumatraPDF (print to PDF) #
- Open the EPUB.
- File → Print… (
Ctrl + P). - Pick the Microsoft Print to PDF printer and click Print.
- Choose where to save the PDF.
The same from the command line, without dialogs:
SumatraPDF.exe -print-to "Microsoft Print to PDF" -print-settings "output=C:\out\book.pdf" book.epub
SumatraPDF prints each page as an image (see Printing), so the PDF has no text layer: you can’t select, copy or search text in it, and it is many times bigger than one made with
sumatrapdf-tool convert (7 MB instead of 160 kB for a short test book).See also #
- sumatrapdf-tool convert
- Printing —
-print-toand-print-settings - Customize eBook UI — how SumatraPDF shows EPUB
- Convert images to PDF
- Convert comics to PDF
- All cmd-line tools