Apache PDFBox - Split Pages
🔧 Operation Name
Apache PDFBox - Split Pages
splitPages
🧾 Description
Splits a PDF document into multiple smaller PDFs. You can:
Split into individual pages, or
Split in larger chunks using the
pageIncrement
parameter.
✅ Inputs
PDF File [Binary]
InputStream
(Binary)
✅
The PDF document to be split.
Page Increment
Integer
❌ (Optional)
How many pages per chunk. Default is 1
(split into single-page PDFs). Set to e.g. 3
to split every 3 pages into one part.
📤 Output
Payload:
List<InputStream>
(List of binary streams) A list of split PDFs (each withpageIncrement
number of pages, except the last chunk which may have fewer).Attributes:
PdfBoxFileAttributes
Metadata from the original file: number of pages, size, title, etc.
🧪 MuleSoft Flow Example
Here’s how to call this operation in a MuleSoft flow:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:pdfbox="http://www.mulesoft.org/schema/mule/pdfbox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/pdfbox
http://www.mulesoft.org/schema/mule/pdfbox/current/mule-pdfbox.xsd
http://www.mulesoft.org/schema/mule/file
http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
<flow name="main">
<scheduler doc:name="Scheduler" doc:id="dsgkfy" >
<scheduling-strategy>
<fixed-frequency timeUnit="HOURS"/>
</scheduling-strategy>
</scheduler>
<flow-ref name="Apache PDFBox - Split Pages" />
</flow>
<sub-flow name="Apache PDFBox - Split Pages">
<set-payload doc:id="vxsfk5" doc:name="Set payload" mimeType="application/octet-stream" value='#[%dw 2.0
output application/java
---readUrl("https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf", "application/octet-stream") as Binary]'></set-payload>
<pdfbox:split-pdf-by-increment doc:name="Apache PDFBox - Split Pages" doc:id="tcisia" pageIncrement="2"/>
<logger doc:name="Logger" doc:id="ecdqs5s" message='#[%dw 2.0
output text
---
"\n\n Apache PDFBox - Split Pages"
++ "\n\n⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄"
++ "\n\nSplit Pages Attributes: " ++ (write(attributes, "application/json")) as String
++ "\n\nSplit Pages Payload: " ++ "Number of separate pdf Docs is " ++ (sizeOf(payload) as String)
++ "\n\n^^^^^^^^^^^^^^^^^^^^"
++ "\n\n Apache PDFBox - Split Pages"
++ "\n\n"]'/>
<foreach doc:name="Foreach" doc:id="pjrtvx" batchSize="1">
<file:write path='#["test" ++ (vars.counter as String) ++ ".pdf"]' doc:name="Write" doc:id="qjtqjy" />
</foreach>
</sub-flow>
</mule>
🔍 Notes
If
pageIncrement
is not specified, it defaults to1
— i.e., one page per output PDF.Set
pageIncrement = 2
to split into documents containing two pages each, and so on.The last part may contain fewer pages if the total isn’t divisible by the increment.
Underlying Application Interface:
Last updated