Skip to main content

PdfPageSplitter

Split PDFs pages so each pages are treated as individual documents.

Notes

May not work on all PDFs — encrypted ones in particular.

Each page produced carries a document.pdf.pageNumber field and a document.pdf.numberOfPages field. The original PDF is kept alongside its pages; set discardOriginal to true to keep only the pages.

To drop the original later in the pipeline instead, reject the documents that have no page number — those are the containers rather than the pages:

{
"if": {
"condition": {
"class": "BlankCondition",
"fieldMatcher": { "pattern": "document.pdf.pageNumber" }
},
"then": [
{ "handler": { "class": "Reject", "message": "Original PDF container" } }
]
}
}

By default this splitter applies only to documents whose content type is application/pdf.

Should be used as a pre-parse handler.

Examples

The following example will split PDFs and will append the page number to the original PDF reference as "#page1", "#page2", etc.

handler:
class: PdfPageSplitter
referencePagePrefix: "#page"

Usage

Full configuration skeleton, with every option and its default
class: PdfPageSplitter
contentTypeMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
discardOriginal: false
label: string
referencePagePrefix: string

Properties

PropertyTypeRequiredDefault
contentTypeMatcherTextMatcherNoTextMatcher
discardOriginalbooleanNofalse
labelstringNo-
referencePagePrefixstringNo#

Property Details

contentTypeMatcher

Restricts processing to documents whose content type matches the specified pattern. When not set, the handler applies to all content types.

discardOriginal

Discard the original document after the split is performed.

label

An optional, user-supplied label for this step in the importer pipeline. It has no effect on processing — it exists purely to help identify this step, for example in large configurations or in the visual configurator.

referencePagePrefix

Defines the prefix added before the page number in a document reference. Default is "#" such as: