Skip to main content

pdfmerge

Command-line utility for merging, splicing, and rotating PDF documents.

Build Status pdfmerge on PyPI Supported Python versions

Changelog - Issues - Documentation

Why?

I find myself merging bits of different PDFs fairly regularly and really wanted a simple CLI way to do it.

Install

python -m pip install pdfmerge

Usage

$ pdfmerge [-h] [--version] [-o FILE|--output FILE] [-p PASSWORD|--password PASSWORD] PATH[RULE[, RULE ...]] [PATH[RULE, ...]] ...]
  • -o, --output output file (default: output.pdf). Must not be any of the input files.

  • -p, '--password` password for encrypted files (default: empty string).

  • PATH a file, directory, or wildcard string (e.g., file*.pdf) of files to merge.

  • RULE an optional string indicating which pages to extract and rotate. The syntax for each rule is:

    [START][..][END][ROTATE]
    

    Where START and END are positive (1-based) or negative page numbers and ROTATE is one of >, V, or < indicating a clockwise rotation of 90, 180, 270 degrees, respectively.

Command-line Example

$ pdfmerge -o out.pdf file1.pdf file2.pdf[3,3] file2.pdf[1V,2..-1] "other*.pdf[<]" "/path/pdf[1..4>,5]"

This example illustrates several features:

  • specifying an output file (must not be any of the input files)
  • merging multiple files, some more than once
  • splicing parts of file using indices (1-based; negatives allowed)
  • including the same page multiple times
  • rotating a page or page range
  • merging all the PDFs in a directory

Read more about the options

Python Module Usage

pdfmerge can also be imported into python scripts.

from pdfmerge import pdfmerge
pdfmerge(["pdf-1.pdf", "pdf-2.pdf[2>]"], "output.pdf")

License

MIT License

Release files for pdfmerge 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdfmerge 1.0.0
File Size Uploaded
pdfmerge-1.0.0.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdfmerge 1.0.0
File Interpreter ABI Platform
pdfmerge-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / pdfmerge-1.0.0.tar.gz

Download URL pdfmerge-1.0.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5641742b4d6c4512dd6459282f45de6e7ac8c8374bf7404809f050d5fa24eefd
BLAKE2b-256 checksum
How to use checksums
5550e9751e29937fb5470fe874547c0d81c02defe8b0c3463255423772562332
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / pdfmerge-1.0.0-py3-none-any.whl

Download URL pdfmerge-1.0.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eca68c41af5cb89d78727932994ae6ef5f858f9e5459509300adf93d726e9e8e
BLAKE2b-256 checksum
How to use checksums
fb2844abc95682aee12ca3fc4672e9a01005770c96e5aeb8a10ddbcee9240433
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page