Skip to main content

Split a PDF file or rearrange its pages into a new PDF file.

Project description

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

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

pdfsplit-0.4.2.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

pdfsplit-0.4.2-py2.5.egg (8.8 kB view details)

Uploaded Source

File details

Details for the file pdfsplit-0.4.2.tar.gz.

File metadata

  • Download URL: pdfsplit-0.4.2.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pdfsplit-0.4.2.tar.gz
Algorithm Hash digest
SHA256 9721ebf91806c8ad3d135c6baf0425373c11850ea1a167582c1aec123fcada9f
MD5 d81f80360c04d18eb1a562fc263b34e7
BLAKE2b-256 ce116b5c2d8b25c8b8ada642a9239792036d792929bf34decef4d9f6fedc8845

See more details on using hashes here.

File details

Details for the file pdfsplit-0.4.2-py2.5.egg.

File metadata

  • Download URL: pdfsplit-0.4.2-py2.5.egg
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pdfsplit-0.4.2-py2.5.egg
Algorithm Hash digest
SHA256 a5ef845fa6021d36dedea0914b09da2cbcb3cc17e2fff6b0710d3c0bb5120802
MD5 6753e53a7650c10b2439c27a0d0664f2
BLAKE2b-256 bc8c7bfd0582526020b57b083420c4b1dab68999ea92076c080479ec7b5dcaa0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page