These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Insert thousand PDFs into other thousand PDF

lichmc
Registered: Mar 12 2008
Posts: 9

My boss wants to insert one specific pdf into another specific pdf. Our library have thousand PDF need to insert into another thousand PDFs. In Acrobat v9, we can batch inserting one into the entire folder, but not the entire folder into one specific PDF. Please help.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The JavaScript function for insterting one PDF into another is "doc.insertPages()". Here's a line of code that inserts all files processed into a file called "MyCollection.pdf".

try{var cPath = "/C/TempData/Result/MyCollection.pdf"; var oDoc = app.openDoc(cPath); oDoc.insertPages(-1,this.path); }catch(e){console.println(e)}

It's best if "MyCollection.pdf" is already open. Pages are inserted at the beginning of the file. If you want to stack the inserted files up differently you'll need to add code to keep track of page numbers.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

lichmc
Registered: Mar 12 2008
Posts: 9
Thanks Thomp.
My boss just wrote long script with AutoIt. I will try your script and let you know. Our problem is that PDF a1 insert into PDF x1, a2 inserted into x2, ... and go on .... for thousand diffierent PDFs. We have thousand PDF type a and thousand PDF type x. Each PDF is unit. Moreover, a1 can only inserted into x1, not x2 nor x3.... a2 inserted into x2, not x3 or x1. It looks like to merge two specific PDFs. But repeat for thousand times.