I have several PDF documents that are over 1,000 pages in length and need to rearrange them from their default page order. Each page of the document has a name on it and each page must be placed into alphabetical order based on the name. I have already generated a work around script outside of Acrobat that will output the proper page order, what I am trying to do at this point is to get Acrobat to place the pages in order according to my generated list.
Example of issue:
I have a list of pages the document should be in (4,782, 43, 125, ect...) and need to have the document rearranged into that order. This involves moving every page of the document.
Any help in this matter would be greatly appreciated, I'm an Acrobat noob.
P.S. If there is also a way to get a script to generate the proper alphabetical order based on the name in Acrobat in addition to also placing the pages in the proper order would be great, that way we can keep it all in one application.
Yes, it's probably possible to do it all using a script, although processing 1000+ pages using a script might prove too much for Acrobat.
If you have the list of the new page order in a text file then you can use a script to read it in and then move the pages to their new locations. However, this is not a trivial task because each time you move a page you're changing the entire page structure of the file and the page numbers in your list will no longer be accurate. I would recommend to create a new file and insert the pages into it in order, instead. This can be done using the insertPages method of the document object.
try67, thanks for the advice! Since I'm kinda new to all of this, would you be able to toss some basic commands my way that could help achieve this?
Do you have the Adobe Acrobat API Reference?
If so, look up the readFileIntoStream method of the util object. You can use it to read in your text file.
Then look up the newDoc, insertPages, deletePages and saveAs methods of the document object. You will need to use those to create your new file. Make sure to carefully read the part about the security limitations of each method. Some of them require a trusted context.
What script do you use to detect the proper alphabetical order?
Bernd Alheit, currently I'm doing that outside of Acrobat as it was simpler to do that way with our limited knowledge of Acrobat. Every page of the document is the same save for some customer information, since it's all the same formatting I just dumped the text into a .txt document and ran a script that would jump down and check the lines where the customers name was located.