Skip to main content

Pdfsplit (formally named pdfslice) is a Python command-line tool and module for splitting and rearranging pages of a PDF document. Using it you can pick single pages or ranges of pages from a PDF document and store them in a new PDF document. To do this you describe these pages with the simple Python slice notation, e.g. 0:10 for the first ten pages, -10:0 for the last ten pages, 0::2 for all even pages, -1::-1 for all pages in reversed order, etc.

Basically, pdfsplit wrapps pyPdf, a package written by Mathieu Fenniak which contains the needed functionality in its core, but does not provide a simple method of using it easily from the command-line or from a Python module.

Features

  • save arbitrary slices of a given PDF document in a new PDF document

  • install a Python module named pdfsplit.py

  • install a Python command-line script named pdfsplit

  • specify arbitrary slices using Python notation, e.g. 0:10:2

  • specify pages using normal page numbers (starting at 1), e.g. -p 1-5

  • allow patterns for output files

  • provide a Unittest test suite

Examples

You can use pdfsplit as a Python module e.g. like in the following interactive Python session:

>>> from pdfsplit import splitPages
>>>
>>> splitPages("file.pdf", [slice(0, 1, None)])    # i.e. [0]
written: file-split.pdf
>>> splitPages("file.pdf", [slice(None, None, 2)]) # i.e. [::2]
written: file-split.pdf

In addition there is a script named pdfsplit, which can be used more easily from the system command-line like this (you can see many more examples when typing pdfsplit -h on the command-line):

$ pdfsplit 0 file.pdf
written: file-split.pdf
$ pdfsplit ::2 file.pdf
written: file-split.pdf
$ pdfsplit -p -o "%(dirname)s/%(base)s-p%(indices)s%(ext)s" 3-5 file.pdf
written: file-p3-5.pdf

Metadata

Release files for pdfsplit 0.4.2

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

Source distribution (sdist)

Source distribution for pdfsplit 0.4.2
File Size Uploaded
pdfsplit-0.4.2.tar.gz 23.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdfsplit 0.4.2
File Interpreter ABI Platform
pdfsplit-0.4.2-py2.5.egg Legacy Egg format - - Details

Total release size: 32.0 kB

Release files / pdfsplit-0.4.2.tar.gz

Download URL pdfsplit-0.4.2.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9721ebf91806c8ad3d135c6baf0425373c11850ea1a167582c1aec123fcada9f
BLAKE2b-256 checksum
How to use checksums
ce116b5c2d8b25c8b8ada642a9239792036d792929bf34decef4d9f6fedc8845
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pdfsplit-0.4.2-py2.5.egg

Download URL pdfsplit-0.4.2-py2.5.egg
Size 8.8 kB
Tags Egg
SHA-256 checksum
How to use checksums
a5ef845fa6021d36dedea0914b09da2cbcb3cc17e2fff6b0710d3c0bb5120802
BLAKE2b-256 checksum
How to use checksums
bc8c7bfd0582526020b57b083420c4b1dab68999ea92076c080479ec7b5dcaa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

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