Lightweight Python package for converting a pdf into a print-ready book format.
Project description
pdf-to-book
Lightweight Python package for converting a pdf into a print-ready book format. Takes in portrait orientation pdf file pages and puts two pages onto each side of paper. Handles imposition for easy ordering of pages after folding/cutting (2-up, duplex ready layout)
Features
- Supports letter and A4 print paper sizes
- Adjustable gutter and margin to account for space taken up by binding
- Adjustable zoom level
- Optional line between pages indicating where to fold/cut
Install dependencies:
pip install PyMuPDF
Install pdf-to-book:
pip install pdf-to-book
Quickstart
If your python Scripts folder is included in PATH, you can directly call pdf-to-book as:
pdf-to-book input.pdf output.pdf
Alternatively you can call it via python:
python -m pdf_to_book input.pdf output.pdf
General usage
usage: pdf-to-book [-h] [--paper PAPER] [--gutter-mm GUTTER_MM] [--margin-mm MARGIN_MM] [--zoom ZOOM] [--line] input output
positional arguments:
input input PDF
output output PDF (2-up, duplex-ready)
options:
-h, --help show this help message and exit
--paper PAPER paper size: 'auto' (default), 'letter', or 'a4'
--gutter-mm GUTTER_MM
inner gutter in mm (default 6 mm)
--margin-mm MARGIN_MM
outer/top/bottom margin in mm (default 4 mm)
--zoom ZOOM page zoom factor (e.g. 1.2 = 120%). Default 1.0
--line draw vertical fold/cut guide line at center
Example
See the example folder for a conversion of the first four pages of Fyodor Dostoevsky's "Notes from the Underground"
Here are screenshots resulting from the following command:
pdf-to-book --zoom 1.25 --line input.pdf output.pdf
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdf_to_book-0.0.1.tar.gz.
File metadata
- Download URL: pdf_to_book-0.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d9f92171038d072b1fdec8f006cbee512cb9524add1be5289aa4e19e4eca27e
|
|
| MD5 |
94ae77cb72d3fa671b20f5ce046ec759
|
|
| BLAKE2b-256 |
7c8f33d53e1f0452bf359b277177f863f903c1998e367589c1ff6b9c17ea4ac5
|
File details
Details for the file pdf_to_book-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pdf_to_book-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe00613fb401d51eee2c89e1a416698f757b860f693d7152f5470540e823262c
|
|
| MD5 |
65c22e9a26c1310ff178a303706ef43c
|
|
| BLAKE2b-256 |
bdf9341040d3fc2b5135735db9be45073e4ae4df838b73670fa32db5250c8efb
|