Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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
Release History

Release History

This version
History Node

0.4.2

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pdfsplit-0.4.2-py2.5.egg (8.8 kB) Copy SHA256 Checksum SHA256 2.5 Egg Sep 17, 2008
pdfsplit-0.4.2.tar.gz (23.3 kB) Copy SHA256 Checksum SHA256 Source Sep 17, 2008

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting