Split pages from one PDF into one or more new PDFs.
The page range can
- make subsets (e.g., pages 1-20 or every 5th page from 1-100)
- delete pages, by dropping them from the range extracted
- insert blank pages, by specifying page
- arbitrarily rearrange pages (e.g., reverse all pages)
- add duplicate pages (e.g., three copies of the signature page of a contract)
- given a PDF with reordered pages (for example, all odd-numbered pages followed by all even)
conveniently restore the original order
java tool.pdf.Split [options] PDF-filename
The split version of the PDF is named with
- -page range --
extract pages in range.
PDF page numbers refer to physical pages, not logical numbers or the numbers printed on the pages,
from 1 to the total number of pages.
A blank page can be inserted with the special case page number of
A single PDF can be split into multiple PDFs by supplying multiple page ranges separated by semicolons.
- -1 --
splits each page (in the selected -page range) into its own PDF
- -doublesided aka -duplex --
Some printers can print duplex mode, that is, on the front and back of paper as it is printed.
On non-duplex printers, double-sided printing can be achieved by first printing the page front sides,
next turning the printed papers over and reloading the printer,
and finally printing the backs.
This option splits a PDF (actually each -page range) into two, one with the fronts and another with the backs.
(If the -page is not set and therefore all pages are selected,
it is equivalent to
java tool.pdf.Split -page odd;even,
java tool.pdf.Split -page odd;even,0 if there is one more odd page than even.)
- -password password -- password if PDF is encrypted
-x appended to the original file name.
1. Subset the first 20 pages and three copies of the last.
java tool.pdf.Split -page 1-20,last,last,last contract.pdf
2. Rearrange pages to all odd followed by all even.
java tool.pdf.Split -page odd,even for-non-duplex-copier.pdf
3. Delete page 5.
java tool.pdf.Split -page 1-4,5-end contract.pdf
4. Insert blank page after cover page.
java tool.pdf.Split -page 1,b,2-end report.pdf
5. Split page ranges into multiple PDFs by separating ranges with semicolons.
java tool.pdf.Split -page "1-12;13-20;21-end" book-with-chapters.pdf
5. Split page first 1000 pages into multiple PDFs of 100 pages each.
java tool.pdf.Split -page "1-1000/100" big.pdf
7. For double-sided printing on a non-duplex printing, split the first 11 pages into a PDF with the odd pages
and another PDF with the even pages.
Since there is an odd number of pages, the PDF with the even pages is given an additional blank page in order to match the number of odd pages.
java tool.pdf.Split -page 1-11 -doublesided handouts.pdf
8. Given a PDF with rearranged pages, you can conveniently recover the original order
backmap operator to the -page option.
For example, if the PDF has all the odd pages followed by all the even pages,
for a page order of 1,3,5,...,2,4,6,..., then the following
back maps this ordering to the original 1,2,3,4,5,6,....
java tool.pdf.Split -page odd,even,backmap odd-even.pdf
If the odd pages are in one PDF and the even in another, you can first use the Merge tool.
Some PDF entities span multiple pages, not all of which are in the split-off PDF.
These are handled as follows.
- Outline aka hierarical bookmarks are retained if they point to a page in the split-off PDF, thrown out if not.
Outline nesting is preserved.
- Interactive fill-in forms span the entire document, possibly with form fields on several pages.
If the split-off PDF takes from the source PDF either no pages with fields or all the pages with fields, then this fact is not noted.
If however the split off PDF has some but not all such pages, then a warning is issued.
If you intend to subsequently merge the split portion with another split portion with the other pages, all is well;
if you don't, then some fields in the form cannot be set interactively.