Split a document every 2 pages and make a new PDF named by text in the document help
Copy link to clipboard
Copied
Hello!
I am new to using Adobe Acrobat Pro DC so this may be obvious. I have a PDF that is 985 pages long that was created by a mail merge. The original document is a 2 page record request. The mail merge created one large document with all he records needing to be requested that has individual names and case numbers every 2 pages. I need to separate each record and name it according to he case number.
My thoughts are I will either need a third party plug in (open to suggestions, but it is not preferred), or I need to create a custom tool, or I need to do some JavaScript thing (I do not know javascript and should not be trusted with this option), or using action wizard create a standard process. Can someone help with this/ below are some ideas if this sparks inspiration for someone:
1. I could automate a bookmark that is named by text identified in the document. I don't know if I can do this at an inerval of every 2 pages automatically.
2. I could split the document every 2 pages and name it based on the bookmark
3. I could use this AI generated JavaScript (I don't know where to put it to make it do anything)
function addBookmark(label, pageNum) { const bookmarkRoot = this.bookmarkRoot; const index = bookmarkRoot.children ? bookmarkRoot.children.length : 0; bookmarkRoot.createChild(label, `this.pageNum = ${pageNum}`, index); } // Example usage: addBookmark("Case number:****", 1); // Replace with your desired label and page number
Copy link to clipboard
Copied
You've said the individual documents are 2 pages long. Is this always true, and if so, then how come the combined document is an odd number of pages long?
It's quite simple to split along two pages. Bookmarking is not necessary.
The difficult part is finding the case number? Your bookmark script (doesn't the mailmerge create bookmarks already?) implies that the case numbers follow some pattern that is predicitable. Is this true? If so then the split and the naming can be easily done in an Acrobat automation script.
However, I think the real solution is to create the individual documents in the first place by the "mail merge" app. What are you using? The mailmerge could be done with a script in Acrobat that does everything you want.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Hi Thom,
Thank you for your reply. It may actually be 986 but I was using a round number. They are always 2 page documents. However, the case numbers do not follow any normal pattern and are generated randomly.
I am using Microsoft Word to mail merge.
Copy link to clipboard
Copied
Where are the case numbers stored? Are they in an Excel file? It is possible for a script to read a csv file. If the case numbers are in the order in the CSV file as the mail merge file then the case numbers could be acquired in from the CSV.
Are they in the PDF page text? It is possible to extract text from the page if it's location or format is consistent and unique.
Or a script could be written to use the Excel file (saved as CSV) to perform the mail merge and save individual files with the correct name.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Hi Thom,
Yes, the information is in an excel and could be aquired through reading the CSV file. When I did the mail merge originally it saved all of the requests as one big PDF instead of individual documents. So, I was just going to try and splice them from the PDF. But I found a video on saving them individually.
I may come back with more questions about saving them based on the CSV data in the excel.
Thank you!

