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: