Skip to main content
Known Participant
August 4, 2026
Question

How to dynamically split a PDF?

  • August 4, 2026
  • 2 replies
  • 32 views

My use case is I have a large PDF that is essentially a bunch of smaller PDFs stitched together. Each smaller PDF has a dynamic number of pages, and they’re split by a separator page, so a human can tell when an individual document starts.

 

I know there’s a PDF Tools plug in, but it doesn’t seem like there’s functionality to split by a separator page or something similar - it’s all by a specified page range or by number of pages in a document.

 

The best thing I can think of right now is to use AI or something to find out where the separator pages are, the page ranges of the individual documents are, and loop through the large document until the end, but that sounds like it might be complicated and I’m wondering if there’s a simpler solution?

 

Thank you in advance!

2 replies

mathieud0001
Brainy
August 4, 2026

You might be able to find seperator pages with Find Pages with Text to find the seperator pages and then use Extract PDF Pages to find the pages.

Otherwise, if you have access to AI, it could be easier to do that way.

kapils024874
Inspiring
August 7, 2026

Using AI for a simple text-matching problem introduces massive unnecessary latency, cost, and potential failure points.
Here's what I'd do instead: leverage the specific expression functions already bundled inside the PDF Tools plug-in to calculate the page ranges dynamically. The risk in your AI approach is over-engineering a solution that can be natively solved with a basic string search.

You can architect this efficiently in three steps:

   1.  Find Separator Pages: Use the Find Pages with Text function to get an array of page numbers containing your specific separator text.

  2.  Calculate Ranges: Use Get PDF Metadata to find the total document page count, then write an expression rule to calculate the exact start and end pages for each document between those separators.

   3.  Extract Documents: Loop the Extract PDF Pages smart service in a process model, passing in your calculated page ranges to split the files.
 

a!localVariables(
/* Replace these local variables with rule inputs (e.g., ri!separatorPages, ri!totalPages) */
local!separatorPages: {1, 5, 9},
local!totalPages: 12,

/* Append artificial boundaries for the start (0) and end (totalPages + 1) */
local!boundaries: append(0, local!separatorPages, local!totalPages + 1),

/* Calculate the page intervals */
local!allIntervals: a!forEach(
items: enumerate(length(local!boundaries) - 1) + 1,
expression: a!localVariables(
local!startPage: local!boundaries[fv!item] + 1,
local!endPage: local!boundaries[fv!item + 1] - 1,

/* Only return a map if the start page is less than or equal to the end page. */
/* This completely prevents errors from consecutive separator pages. */
if(
local!startPage <= local!endPage,
a!map(
startPage: local!startPage,
endPage: local!endPage
),
null
)
)
),

/* Remove any nulls caused by empty intervals to output a clean array */
reject(fn!isnull, local!allIntervals)
)


Let me know if that helps.