A professional Python library for PDF imposition, resizing, and tiling.
Project description
py-impose 🖨️
A professional Python library for PDF imposition, resizing, and tiling. Easily prepare PDF documents for print using a clean, pipeline-oriented API.
Motivation
I originally built py-impose to handle automated imposition for web-to-print order systems, specifically dealing with dynamic A4 to SRA3 conversions and stapling logic. I realized this pipeline could be highly useful to other developers dealing with print automation, so I extracted it into this standalone, open-source library. Whether you are building a full print-shop backend or just need to tile some PDFs for a personal project, I hope this helps!
Key Features
- Pipeline Processing: Load, resize, bleed, tile, and export PDFs in a single chain.
- Intelligent Tiling: Automatically computes grids for optimal printing on target paper sizes (e.g., A4 onto SRA3).
- Dynamic Configuration: Use a unified
update_value()method to tweak cut lines, margins, and bleed on the fly. - Native PDF Units: Built entirely around standard PDF points (pt) for absolute precision, with built-in helpers for millimeter conversion.
Prerequisites
Before using py-impose, please ensure you have the following installed on your system:
- LibreOffice: Required for the headless conversion of non-PDF file formats (such as
.docx) into standard PDFs before they enter the processing pipeline.
Installation
You can install py-impose directly with PIP:
pip install py-impose
or build it from source and install the required dependencies using the provided requirements.txt:
git clone [https://github.com/ManuYT-dev/py-impose.git](https://github.com/ManuYT-dev/py-impose.git)
cd py-impose
pip install -r requirements.txt
pip install -e .
Note: This library relies on pymupdf to handle the heavy lifting of PDF manipulation.
Quick Start
The core of the library is the PDFProcessor class, which allows you to chain commands together.
from py_impose import PDFProcessor, PaperTypes, PageSize
# Initialize the pipeline
processor = PDFProcessor(
input_path="input_design.pdf",
output_path="print_ready_SRA3.pdf",
tile_to=PaperTypes.SRA3.value
)
# Configure layout settings (Values are in points)
processor.update_value(
tile__outer_margin=PageSize.mm_to_points(10.0),
tile__line_thickness=0.5,
tile__draw_lines=True,
bleed__default_bleed=PageSize.mm_to_points(3.0)
)
# Run the full process
processor.run()
Documentation
For a complete list of all configurable parameters, dynamic settings, and advanced usage, please read the PDFProcessor Reference Guide.
Debugging UI
The repository includes a built-in tkinter graphical interface for testing and debugging your PDF layouts locally.
To use it, run:
python debug/debug_ui.py
Contributing
Contributions are always welcome! If you find a bug or have an idea for a new feature (like new binding logic or paper formats), feel free to open an issue or submit a pull request.
License
This project is licensed under the PolyForm Noncommercial License 1.0.0. You are free to use, modify, and distribute this software for personal or educational purposes, but commercial use is strictly prohibited. See the LICENSE file for full details.
Project details
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 py_impose-0.1.4.tar.gz.
File metadata
- Download URL: py_impose-0.1.4.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d0beea36d7f4d8b71b97987e4ee1bd2745013ebb74c3cbcfb3bf53303b2cc02
|
|
| MD5 |
462607772d31c46a4ff18f4ce3b66fa6
|
|
| BLAKE2b-256 |
1a75b9269befbaf6dce349aa1c25ad74e81a71d6c950eb1efa2b377ed5f8950d
|
File details
Details for the file py_impose-0.1.4-py3-none-any.whl.
File metadata
- Download URL: py_impose-0.1.4-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88fed513ed84810026a5211a609fc8fc5ab8da95aba8c357d7d660cac755f637
|
|
| MD5 |
1184c43bccb2fb40dedac7008a4ce621
|
|
| BLAKE2b-256 |
83a0c1790818c1b9f41f84aeedc00236565a58a96ea930471a78cf8c4ff0f2c7
|