Even though PDFs are perfect for presenting and preserving long documents, there are times when you will need to split them into smaller chunks. This is a convenient way of eliminating unwanted content, making smaller file sizes, and handling large files efficiently.
We can quickly split those long documents into smaller logical document using PDFFiddler Playground. It provides three ways to split the document
Let's walk through the below steps, to split any PDF into smaller ones.
Upload any long PDF, which you want to split
//load document doc = load($input)
Split PDF, using any one of the below methods.
1. Split PDF, by every X Page
You can split the document by providing a specific Page range. In the below example, we are splitting the document into one-one page document.
//split document into one one page invoice invoices = doc.split(1)
2. Split PDF at a particular page, if specific content present in a region
Suppose, if you wanted to split the document if a specific content ("Page 1") present in a particular region of a Page.
Preview the uploaded PDF, and then click and draw the region, where Page 1 is present
Now add below script
//split document into invoices, if Page1 region contains Page 1 invoices = doc.split(OnMatch($Page1, "Page 1"))
3. Split PDF at a particular page, if specific content changes in a region
Suppose, if you wanted to split the document if a specific content ("Policy number") changes in a particular region of a Page.
Preview the uploaded PDF, and then click and draw the region, where Policy number is present
Now add below script
//split document into invoices, if Policy region changes invoices = doc.split(OnChange($Policy))
Output all the small documents, which got split.
Now, click on Run Button.
Voila, now you can download all your documents as zip or a specific file
The above example provides a very simple steps, to split the document into multiple documents.
We can also, do some complex tasks, such as do some enhancement (eg. adding a Page number or adding attachment or make it duplex) in those multiple documents and, then merge it back to a single document.
Ready to use PDFFiddler Playground Splitter functionality