Skip to main content

Place user-defined margins around PDF page content

Project description

set-pdf-margins

This script places user-defined margins around the content of each page of a given PDF file. The left and top margins are given explicitly. The right and bottom margins result from explicitly given page sizes in horizontal (x) and vertical (y) directions. The page content is not rescaled. The document outline is preserved. This script is meant to facilitate PDF reading and margin note taking on tablets and e-readers. Note that correctly determining the bounding box of the content of a PDF page is difficult and your mileage may vary depending on your input PDF.

Installation

[!IMPORTANT] set-pdf-margins requires ghostscript to be installed and available on your system.

Install with pip:

pip install set-pdf-margins

Or use uvx:

uvx set-pdf-margins --help

Usage

$ set-pdf-margins [OPTIONS] PDF_INPUT_PATH MARGIN_LEFT MARGIN_TOP PAGE_SIZE_X PAGE_SIZE_Y

Arguments:

  • PDF_INPUT_PATH: [required]
  • MARGIN_LEFT: [required]
  • MARGIN_TOP: [required]
  • PAGE_SIZE_X: [required]
  • PAGE_SIZE_Y: [required]

Options:

  • --pdf-output-path PATH
  • --unit [pt|mm]: [default: pt]
  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

If your page content is too large to fit on your target page size, or if you want to crop headers, footers, or page numbers before determining the bounding boxes of the actual content of each page, consider preprocessing your file using other tools first.

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

set_pdf_margins-0.1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

set_pdf_margins-0.1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: set_pdf_margins-0.1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for set_pdf_margins-0.1.1.tar.gz
Algorithm Hash digest
SHA256 95c4a0bc51d566352201e55be56688bfe6812f84e84c7d612e9c171e445e20f4
MD5 7945f648e6aa84ca2bd285fb775226a2
BLAKE2b-256 f02c70ad4427b9f165e8f53b79ebb5249c96eacd0f577f89f4be8c47ced11fc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for set_pdf_margins-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf6cd8883c71c97e3c95a360dd587112aed2a41d868d8646a1f1b419af369d60
MD5 ae3f6e455da83401a10686047c4dfd58
BLAKE2b-256 69da9b8111a2af9fa014b901a740e64c766f8169717f18c762dac3fce9b16961

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