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 with PIP:

pip install py-impose

or build it 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

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.2.tar.gz (13.4 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.2-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_impose-0.1.2.tar.gz
  • Upload date:
  • Size: 13.4 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.2.tar.gz
Algorithm Hash digest
SHA256 828f5f7813fce82943ea963ab2571795cd575391f9618a675d2ef9fad65dd790
MD5 777e47612a7382aa446d641ad560d531
BLAKE2b-256 03f930ee2accfca573a84955b7048ca9c705b0eabb99656e302b293d9e3fd442

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_impose-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f4477eb5bc6efc21b3bc6d8b645da99798fa28dac4c427c6d234d611f4b392c3
MD5 0d5f121d590a160840f9796af85ea83d
BLAKE2b-256 efd28cc418074206c4166cae88d6ce892f2696576414c6964e38d07b072bb7ce

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