Skip to main content

No project description provided

Project description

Convert Two Up Imposed PDF

A Python tool to process scanned 2-up imposed PDFs (signature scans) and produce upright, single-page PDFs in correct reading order.

This tool handles:

  • Alternating 90° rotated scans (top of page on right/left alternates)
  • 2-up page splitting (left/right halves of each scanned sheet)
  • Signature reordering to restore natural reading order
  • Optional compression and quality control for high-DPI scans

Features

  • Fully automated for signature PDFs (number of pages must be a multiple of 4)
  • Outputs a standard, upright PDF ready for printing or digital use
  • Adjustable JPEG compression for smaller file sizes
  • Cross-platform (requires Python 3.8+)

Installation

pip install convert-two-up-imposed-pdf

Usage

convert-two-up-imposed-pdf <input_pdf> <output_pdf> [--dpi DPI]

Arguments

Argument Description
input_pdf Path to the scanned 2-up PDF file
output_pdf Path to save the final upright, single-page PDF
--dpi (Optional) Render DPI for rasterization. Default: 150. Higher DPI → better quality, larger files

Example

convert-two-up-imposed-pdf scanned_booklet.pdf output_booklet.pdf --dpi 200
  • Detects the number of scanned sheets
  • Computes total logical pages
  • Applies alternating rotation correction
  • Splits 2-up pages
  • Reorders pages according to booklet imposition
  • Saves the final upright PDF

Compression and Quality Tips

  • By default, pages are saved as JPEG to reduce file size
  • Adjust --dpi for higher or lower resolution
  • You can tweak the JPEG quality in the code (default: 85) to balance file size and image fidelity
  • Optional grayscale conversion and subsampling further reduce file size for text-heavy scans

Requirements


Limitations

  • Total logical pages must be a multiple of 4
  • Assumes strictly alternating rotation for scanned pages (top of page right/left)
  • Works best for scanned image-based PDFs; vector PDFs may not behave as expected

License

Unlicense


Acknowledgements

Most code in this repository, including this README, was produced by the ChatGPT (OpenAI) LLM. Some tweaks and improvements were made by the human author. The human author reviewed and verified all output.

  • Uses PyMuPDF for PDF processing
  • Uses Pillow for image manipulation

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

convert_two_up_imposed_pdf-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

convert_two_up_imposed_pdf-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file convert_two_up_imposed_pdf-1.0.0.tar.gz.

File metadata

File hashes

Hashes for convert_two_up_imposed_pdf-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3cc112a48cee04f35fba9f4c53b498e0a692b760d3668e3ce7a3975a72a04f9e
MD5 f5ea4d02e222d72131ccad1810fbe139
BLAKE2b-256 6ab16a0997bf7f1ab3c3027bb83d8fac9f48210b0f1b7a085eddc409c5495bf9

See more details on using hashes here.

Provenance

The following attestation bundles were made for convert_two_up_imposed_pdf-1.0.0.tar.gz:

Publisher: publish-to-pypi.yml on gene1wood/convert-two-up-imposed-pdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file convert_two_up_imposed_pdf-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for convert_two_up_imposed_pdf-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 146f922fd8058412b0c0af6ee706d047f00f9cae4f4bd5467038c8af68d6c7c4
MD5 a2f8aa3a21d4b993ff0ad2b50f894237
BLAKE2b-256 d1fc71157c6c04184170b3503c8cbf29055abdedd81ed9bd7d3b390e3949265d

See more details on using hashes here.

Provenance

The following attestation bundles were made for convert_two_up_imposed_pdf-1.0.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on gene1wood/convert-two-up-imposed-pdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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