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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdfmerge-1.0.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

pdfmerge-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pdfmerge-1.0.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pdfmerge-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5641742b4d6c4512dd6459282f45de6e7ac8c8374bf7404809f050d5fa24eefd
MD5 438597c054dcb3cd2aecdd2703d9591f
BLAKE2b-256 5550e9751e29937fb5470fe874547c0d81c02defe8b0c3463255423772562332

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pdfmerge-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pdfmerge-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eca68c41af5cb89d78727932994ae6ef5f858f9e5459509300adf93d726e9e8e
MD5 6db0c0489b677e7654bdd74a8946c7dd
BLAKE2b-256 fb2844abc95682aee12ca3fc4672e9a01005770c96e5aeb8a10ddbcee9240433

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.0.7

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Supported by

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