Getting a list of page numbers of search text
- May 8, 2023
- 2 replies
- 2540 views
Hi,
New to this forum and to JavaScript. I found a possible answer-adjacent thread under "Get Page number of the search text". I honestly don’t know what I'm looking at when I'm looking at the JavaScript. And maybe there's a native tool in Acrobat that I don’t know about.
I'm using Adobe Acrobat Pro - Continuous Release, which I guess means I'm up to date.
I've attached a sample PDF as I cannot attach the real deal because this is a work thing, and huge.
I have a 600+ page PDF that's basically a mail-merge document - you know, 600 or so pages of the same form repeated for hundreds of recipients. Generally, the form is 1 page per, but sometimes 2 or 3 pages. So, it's not a matter of "page 1 is this person, page 2 is that person..." and so on. But since there's repeatable, identifiable information that indicates a new form, I figure I can use that as a locator to identify where all the recipients' pages start - and then get a result like an index.
Please keep in mind this is NOT A PDF FORM form, it just looks like that - generated by our software and output into a PDF. So, when I use the word FORM, I do not mean a PDF form. Thanks 🙂
Take the example PDF. The output would look like
Mike Michaelson - page 1
Rich Richardson - page 3
Tom Tomlinson - page 5
Vinnie The Stitch - page 6
Now, I do a bit of programming, not JavaScript. So, I can kind of follow along with the logic of it - but the syntax, forget about it. I can think of two ways to do this
- Compare the 600-page PDF against the 600 or so names, finding a per-name result and associated page numbers. That's going to be the most accurate but hardest to set up and a super time-consuming process.
- My PDF has the benefit of already being sorted alphabetically name (kind of like my example PDF). This means I don’t have to search by name; I can instead search by a key phrase - something that I know is going to be on the first page of every form, such as the phrase "Persons Name". Every time I find "Persons Name" I know that's a new form.
Now, #2 sounds like a far easier implementation and a far faster process. The output would instead be:
1
3
5
6
And since the PDF is already alphabetized, this works! I can copy/paste that output and line it up against my list of alphabetized names on my word doc or spreadsheet 1:1. Yeah, it's a bit of manual work in the end, but I'm not looking for a scalpel here - just a hammer for now.
Thanks.
