Skip to main content
Known Participant
August 4, 2026
Solved

How to dynamically split a PDF?

  • August 4, 2026
  • 16 replies
  • 127 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!

Best answer by mikes0011

@katiel0001 - so if you’re saying the separator page is a physical page that’s then scanned in (making a new analog copy each time and in each separate place it’s used in the combined PDF stack), then i’m not sure whether there’s any solution here that will work, beyond potentially passing the whole PDF into an AI Skill and seeing if you can train it to identify and then tell you the page indexes of the separator.  The problem is that an analog-scanned separator page, even if it’s ostensibly the same page used over and over, is alwyas going to result in a slightly different file, and a slightly different embedded image, just due to the small variations you’d get any time you manually scan the same starting page. 

At first it sounded as if the separator page might be some consistent digital file that’s being placed in between the subsequent combined multipage documents in the combined PDF, in which case you could at least test something like the filesize or MD5 signature or something, which would depend on the single-page PDF file represented by the separator page to always be *identical*, but in this case it sounds as if that will not be the case.

Do you have the ability to create an AI Skill and see whether you can ask it to identify the page numbers that have the “separator page” trademarks?

16 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.

Known Participant
August 10, 2026

I’m having trouble finding the Find Pages with Text function, do you have documentation for that?

Nevermind, I found it, but it’s not returning any page number for my documents

 

Known Participant
August 10, 2026

N/a

harshas2775
Brainy
August 11, 2026

You can use Split PDF Into Chunks V2 smart service from PDF Tools plugin to split your entire pdf into single sheets. Then have an AI skill or Get PDF Text  function from the same plugin to read each pdf sheet returned as output from aforementioned smart service. Store the indexes where the separator page is found. Lastly use Merge PDF smart service to merge each document basis the separator indexes array. E.g. if 4 pdfs make one pdf of 11 pages having separators at 2,6,and 8 then separator pdf will have {2,6,8}. You can merge {1,2} for pdf file 1, {3,4,5,6} for file 2 and {7,8} for file 3 and rest in file 4. Hope it helps! 

Known Participant
August 11, 2026

Get PDF Text is returning blanks when I run a pdf document through it

harshas2775
Brainy
August 12, 2026

I tested with PDF Tools version 3.2.0 and the function getpdftext() is working.

E.g. getpdftext(document:246337,startPage:1,endPage:1)

Can you check if there is a syntax issue or share the plugin version you are using?