Skip to main content

Extract Pages From PDF in n8n

Extract Pages From PDF is a PDF4me node action in n8n that builds a new PDF containing only the pages you list. Use it to pull a signature page out of a contract, isolate a single chapter from a manual, or hand downstream steps just the summary pages instead of the whole document.

What this node does

PDF4me: Extract Pages From PDF takes a PDF from Binary Data, a Base64 String, or a URL and returns a new file holding only the pages named in Page Numbers. That field is the whole action: it accepts single pages, hyphenated ranges, mixed lists, and open ranges that run to the end of the document. Because it runs as a workflow step, the same extraction rule applies to every file that arrives without anyone opening an editor.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

Authenticating Your API Request

Every PDF4me node in n8n requires a valid Credential to connect with. Create or select one that holds your PDF4me API key so the workflow can authenticate extraction requests securely.

Important Facts You Should Not Miss

Page Numbers is the only field that matters
It is required and validated. Leave it blank and n8n flags the field before the node will run.
Open ranges handle variable page counts
Writing 10- means page 10 to the end, so one setting works across documents of different lengths.
Pages are numbered from 1
The first page is 1, not 0. Watch this when an earlier code node generates the page list programmatically.
PDF4me node in n8n set to Action Extract Pages From PDF, Input Data Type Binary Data, Input Binary Field data, Document Name output.pdf, an empty required Page Numbers field, and Output Binary Field Name data

PDF4me Extract Pages From PDF parameters panel in n8n

Extract Pages vs Split PDF

Both produce smaller documents, but they answer different questions. Extraction asks which pages you want to keep; splitting asks how the whole document should be divided.

QuestionExtract Pages From PDFSplit PDF
How many files come backOne PDF holding the pages you listedSeveral PDFs covering the whole document
What happens to unlisted pagesThey are absent from the outputThey still appear, in another output file
Typical usePull the signature page, one chapter, or a summary sectionBreak a bundle into per-invoice or per-section files
Driven byAn explicit page list you supplyA split rule such as page count, text, or barcode

What Parameters Does Extract Pages From PDF Need?

Required: Action, Input Data Type, the field matching that input type, Document Name, and Page Numbers. Output Binary Field Name carries a working default of data, and Advanced Options starts empty.

ParameterRequiredWhat it doesExample
ActionRequiredSelects the PDF4me node action to run. Choose Extract Pages From PDF.Extract Pages From PDF
Input Data TypeRequiredFormat of the source PDF input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the PDF. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded content of the source PDF. Required when Input Data Type is Base64 String.JVBERi0xLjQK...
File URLConditionalPublicly reachable HTTPS URL to the source PDF. Required when Input Data Type is URL.https://example.com/report.pdf
Document NameRequiredFilename used for the document on the request, for reference and tracking. Include the .pdf extension.output.pdf
Page NumbersRequiredThe pages to keep. Accepts a comma-separated list, a hyphenated range, a mixed list, or an open range that runs to the end of the document. Pages are numbered from 1.1,3,5-8
Output Binary Field NameOptionalName of the binary property the output item exposes. Defaults to data.data
Advanced OptionsOptionalA collection that starts empty, shown as No properties with an Add Option button. Leave it alone unless you have a specific option to add.No properties

How to Write the Page Numbers Field

PatternExampleWhat comes back
Single page5Just page 5, as a one page PDF.
Comma-separated list1,3,5Pages 1, 3, and 5 in one PDF, with pages 2 and 4 absent.
Hyphenated range2-5Pages 2, 3, 4, and 5, with both ends included.
Mixed list1,3,5-8Page 1, page 3, then the block from 5 to 8.
Open range10-Page 10 through the last page, whatever the document length turns out to be.

Output Fields

A successful run returns one n8n item carrying the extracted PDF.

FieldTypeWhat it contains
Binary (data)BinaryThe extracted PDF, under Output Binary Field Name (default data).
fileNameStringGenerated filename of the extracted PDF.
mimeTypeStringMIME type of the output, always application/pdf.
fileSizeNumberSize of the returned PDF in bytes.
pagesExtractedNumberHow many pages ended up in the output. Compare it against the length of your requested list as a cheap sanity check.
originalPageCountNumberPage count of the source document before extraction.
extractedPageNumbersArrayThe page numbers that were actually extracted, useful for verifying the result against what you asked for.
successBooleanTrue when the extraction completed, false on failure. Use it to branch error handling.
messageStringHuman-readable status message, carrying success confirmation or error detail.

How Do I Set Up Extract Pages From PDF in n8n?

  1. Add PDF4me to your n8n workflow and choose the Extract Pages From PDF action.
  2. In Credential to connect with, select your PDF4me credential or click Create New Credential and paste your API key.
  3. Set Input Data Type to Binary Data (default), Base64 String, or URL and supply the matching source PDF field.
  4. Set Document Name for the source file, including the .pdf extension.
  5. Enter Page Numbers using a list, a range, a mixed list, or an open range.
  6. Leave Output Binary Field Name as data unless a later node expects a different property.
  7. Execute the node and route the returned PDF into the next step, such as storage, email, or a review queue.

Typical Setups

Workflow ExamplesCommon n8n workflow patterns using Extract Pages From PDF.
Pull the signature page from a contract
  1. A signed contract arrives as an email attachment.
  2. Extract Pages From PDF takes the last page using an open range.
  3. The single page is filed against the customer record for quick reference.
Send only the summary to reviewers
  1. A long report is generated on a schedule.
  2. Extract Pages From PDF keeps the first few pages with a range such as 1-3.
  3. Reviewers receive the summary while the full report goes to the archive.
Isolate a chapter from a manual
  1. A support request references one section of a product manual.
  2. Extract Pages From PDF pulls that chapter with a hyphenated range.
  3. The customer gets the relevant pages instead of a large attachment.
Extract then merge into a digest
  1. Several source documents each contain one page worth keeping.
  2. Extract Pages From PDF runs per document to pull that page.
  3. Merge Multiple PDFs combines the results into a single digest.

Practical Tips

Use an open range for variable documents
When the page count differs between files, 10- keeps everything from page 10 onward without knowing the total.
Check pagesExtracted against your request
Comparing the returned count with the number of pages you asked for catches a malformed page list before it reaches the customer.
Remember pages start at 1
A code node that builds the list from a zero-based array will be off by one on every document. Add one when generating the string.
Extract before you merge
Pulling the wanted pages from each source first keeps the merge step small and the final document free of filler.
Branch on the success field
Test the returned success boolean before sending the file onward so a failed extraction raises an alert instead of forwarding an empty result.
Reuse one source for several subsets
The original is untouched, so the same PDF can feed two extraction nodes to produce an internal copy and a customer copy in one run.

Cheat Sheet

FieldValue
ActionExtract Pages From PDF
Input Data TypeBinary Data
Input Binary Fielddata
Document Nameoutput.pdf
Page Numbers1,3,5-8
Output Binary Field Namedata
Advanced OptionsNo properties
CredentialsPDF4me API credential

Common Questions

How do I write the Page Numbers field to extract a range?+
Page Numbers accepts four shapes. A comma-separated list such as 1,3,5 pulls individual pages. A hyphenated range such as 2-5 pulls everything between and including those pages. A mixed list such as 1,3,5-8 combines both. An open range such as 10- runs from page 10 to the end of the document, which is useful when the page count varies between files.
Is extracting pages the same as splitting a PDF?+
No. Extract Pages From PDF returns one new PDF containing only the pages you listed, and the pages you did not list are simply absent. Splitting divides a document into multiple output files covering the whole document. Choose extraction when you want a specific subset, and choose Split PDF when you want every page distributed across several files.
Does extracting pages change the original PDF?+
No. The node reads the source PDF you supply and returns a new file. The original document is untouched, so the same source can be run through several extractions in one workflow to produce different subsets.
What happens if I ask for a page number that does not exist?+
Page Numbers is a required field and is validated when the node runs. Requesting a page beyond the end of the document is an error case rather than a silent skip, so branch on the returned success field before passing the result downstream, especially when the page list is built dynamically from earlier workflow data.
Are the page numbers counted from one or from zero?+
Page numbers start at 1, matching what a reader sees in a PDF viewer. The first page of the document is 1, not 0. This matters most when the page list is generated by an earlier node in n8n code, where zero-based indexing is a common source of off-by-one output.

Same Task on Other Platforms

Get Help