# Convert EPUB to PDF

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](https://www.sumatrapdfreader.org/prerelease)**
- **In SumatraPDF:** **File → Print** to the **Microsoft Print to PDF** printer — pages become images: no text selection or search, much bigger files.

**Convert to PDF…** in SumatraPDF is only for [images](Convert-images-to-PDF.md) and [comics](Convert-comics-to-PDF.md); it's not shown for EPUB.

## Convert from the command line

Use `sumatrapdf-tool.exe convert`, or [SumatraPDF.exe convert](Tools.md) 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](Tool-convert.md).

## Convert in SumatraPDF (print to PDF)

1. Open the EPUB.
2. **File → Print...** (`Ctrl + P`).
3. Pick the **Microsoft Print to PDF** printer and click **Print**.
4. 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](Printing.md)), 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](Tool-convert.md)
- [Printing](Printing.md) — `-print-to` and `-print-settings`
- [Customize eBook UI](Customize-eBook-UI.md) — how SumatraPDF shows EPUB
- [Convert images to PDF](Convert-images-to-PDF.md)
- [Convert comics to PDF](Convert-comics-to-PDF.md)
- [All cmd-line tools](Tools.md)
