Skip to content

Split a PDF ​

Extracts pages from a PDF — ranges (1-3, 5) or every page on its own — as new files added to the run’s attachments.

Split a PDF extracts pages of a PDF as new files, added to the run attachments: ranges (1-3, 5, 8-10, one file per range) or every page on its own. By default the first PDF of the run is split.

The node is only offered when the instance has a documents service.

At a glance ​

  • Type: pdf.split · version 1
  • Category: Data
  • Kind: Step — one stage of a run
  • Effect: No external effect (none) — nothing is written outside Loop & Roll; safe to replay
  • Needs a carrier email: No
  • Connection: None
  • Inputs: main
  • Outputs: main
The ports of “Split a PDF”: what comes in on the left, what goes out on the rightInput: main. Outputs: main. An error output appears when its failure setting is “Follow the Error output”.Split a PDFpdf.splitmainmainerror · only with “Follow the Error output”
The ports of “Split a PDF”: what comes in on the left, what goes out on the right

Parameters ​

selection ​

Attachments to use

  • Type: One choice (options)
  • Required: Yes
  • Default: first
  • Options:
    • all — All attachments: Those of the triggering email, then the files added by earlier steps (a fetched deed, a signed PDF), in that order.
    • first — The first one only: The first attachment, when only one matters.
    • byMime — By file type: By MIME type: application/pdf, or a whole family with image/*.
    • byName — By file name: By name pattern: *.pdf, invoice-*.

mime ​

File type — Exact MIME type (application/pdf) or a whole family (image/*). Left empty, no attachment is kept.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 200 characters at most
  • Example: application/pdf
  • Shown when: selection is byMime
  • Expressions: {{ }} accepted

namePattern ​

File name — Simple pattern: * matches anything, ? one character (*.pdf, invoice-*). Case is ignored.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 200 characters at most
  • Example: *.pdf
  • Shown when: selection is byName
  • Expressions: {{ }} accepted

mode ​

Split

  • Type: One choice (options)
  • Required: Yes
  • Default: ranges
  • Options:
    • ranges — By page ranges: One file per range: 1-3, 4, 5-8.
    • each — One page per file: Every page becomes a file (100 at most).

ranges ​

Pages — Comma-separated ranges. A page outside the document fails the step.

  • Type: Text (string)
  • Required: Yes
  • Default: "" (empty)
  • 500 characters at most
  • Example: 1-3, 5
  • Shown when: mode is ranges
  • Expressions: {{ }} accepted

Outputs ​

  • main

Data produced ​

What this node adds to the run data, and how to read it in an expression. <step> stands for the step key: the node name turned into an identifier (see Data and expressions).

  • {{ data.<step>.files }} — array of { position, filename, mime, size, origin }. The produced files (deed-p1-3.pdf, deed-p4.pdf…), added to the run attachments. The list to walk with a loop.
  • {{ data.<step>.count }} — number. The number of files produced.
  • {{ data.<step>.documents }} — array of { source, files, pages }. For each split PDF: the original attachment, its files and its number of pages.
  • {{ data.<step>.summary }} — string. A one-line description for the run detail, in the member's language.

Example ​

A scanner sends a batch of payslips in a single PDF, one page per payslip:

selection: first
mode: each

Then a loop over {{ data.<step>.files }} that reads and files each page.

Tips ​

  • A page outside the document fails the step (document.invalid_document): check the page count with Read attachments when documents vary.
  • One page per file: 100 files at most. Ranges: 50 at most.
  • At most 5 PDFs split per step.

Loop & Roll — the workflow builder for email.