Skip to main content

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.

Installation

You can install py-impose directly from source:

git clone [https://github.com/ManuYT-dev/py-impose.git](https://github.com/ManuYT-dev/py-impose.git)
cd py-impose
pip install -e .

Note: This library requires 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

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

py_impose-0.1.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_impose-0.1.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file py_impose-0.1.1.tar.gz.

File metadata

  • Download URL: py_impose-0.1.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for py_impose-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a0dbcfe8481a7617cb7920f3a3e4e74fa95cd904aa6c08beb01591602281b513
MD5 2e714f31bd239fa768d24eab2b68bb2c
BLAKE2b-256 a1301072a1e20a0786fc64c3231a9814d2f692231a9e56d242802b22ee1886c2

See more details on using hashes here.

File details

Details for the file py_impose-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: py_impose-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for py_impose-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e877bab32865b55c5fca5410dffcc1b09aec79dc5d7322a7b173801703df83d8
MD5 ff846666d354a086395190466ba954fa
BLAKE2b-256 7b33f18eb5ef504be12afcfa8db126994b27887ef398801392b0b9aaa4c72330

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page