Command-line utility for merging, splicing, and rotating PDF documents.
Project description
pdfmerge
Command-line utility for merging, splicing, and rotating PDF documents.
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
andEND
are positive (1-based) or negative page numbers andROTATE
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
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
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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5641742b4d6c4512dd6459282f45de6e7ac8c8374bf7404809f050d5fa24eefd |
|
MD5 | 438597c054dcb3cd2aecdd2703d9591f |
|
BLAKE2b-256 | 5550e9751e29937fb5470fe874547c0d81c02defe8b0c3463255423772562332 |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | eca68c41af5cb89d78727932994ae6ef5f858f9e5459509300adf93d726e9e8e |
|
MD5 | 6db0c0489b677e7654bdd74a8946c7dd |
|
BLAKE2b-256 | fb2844abc95682aee12ca3fc4672e9a01005770c96e5aeb8a10ddbcee9240433 |