skip to navigation
skip to content

pdfsplit 0.4.2

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

Downloads ↓

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
 
File Type Py Version Uploaded on Size # downloads
pdfsplit-0.4.2-py2.5.egg (md5) Python Egg 2.5 2008-09-17 8KB 747
pdfsplit-0.4.2.tar.gz (md5) Source 2008-09-17 22KB 900