Skip to main content

EPUB PDF wrap

Converts a PDF into an EPUB by rendering and wrapping each page of the PDF in an EPUB page. This is specifically aimed at PDF files that cannot be converted into EPUB any other way without corrupting their visual rendering (comics, scientific papers...).

Installation

pip install epub-pdf-wrap

From source (with dev dependencies for testing):

pip install -e ".[dev]"

Usage

epub-pdf-wrap <pdf-filename> [-o <epub-filename>]

By default the output filename is the input filename with the pdf extension replaced by the epub extension. Running without pip install also works via python -m epub_pdf_wrap.

Options

  • -r <num>, --resolution <num>: target render width in pixels for the pages in the output file. By default the pages are rendered at the resolution the PDF itself declares.
  • -c, --crop-global: trim the white margins around the page content using one common inset for all pages (safe: never clips content on any page, all pages keep the same size).
  • --crop-page: trim the white margins around each page's own content, page by page (trims more aggressively but page sizes may vary).

-c/--crop-global and --crop-page are mutually exclusive; with neither flag the margins are left as-is.

Metadata

Document metadata (title, author, subject, keywords and creation date) is taken from the PDF and written into the EPUB. Empty fields are omitted; the title falls back to the input filename if the PDF has none.

Examples

Convert a paper at a wider resolution and name the output explicitly:

epub-pdf-wrap paper.pdf -o paper.epub -r 1400

Development

python -m venv .venv
.venv\Scripts\activate        # Windows  (or `source .venv/bin/activate` elsewhere)
pip install -e ".[dev]"
pytest

samples/ contains real input PDFs for manually verifying the output.

License

Distributed under the BSD 3-Clause License; see LICENSE. Copyright (c) 2026, Andrea Esuli (andrea@esuli.it).

Release files for epub-pdf-wrap 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for epub-pdf-wrap 0.1.1
File Size Uploaded
epub_pdf_wrap-0.1.1.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for epub-pdf-wrap 0.1.1
File Interpreter ABI Platform
epub_pdf_wrap-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.9 kB

Release files / epub_pdf_wrap-0.1.1.tar.gz

Download URL epub_pdf_wrap-0.1.1.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5287608d66cbd3a93e464a9658bc34f77653f50d3b7ee0426b0959e67e47ad2b
BLAKE2b-256 checksum
How to use checksums
9bc819d2529723d46b8bcf0aed15ff22556c11003f6c8e437ef3f26b6bfb1db1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / epub_pdf_wrap-0.1.1-py3-none-any.whl

Download URL epub_pdf_wrap-0.1.1-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ff030ebb4514118b8ed57346a182858c536f10c25e4855b4a86e779b07ca7be
BLAKE2b-256 checksum
How to use checksums
7998467acbbaa83e33951b5a376d9ac18ccada8db76db56ac9613d0e0497c8ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page