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

How to merge pages using JavaScript

unexist
Registered: Aug 27 2007
Posts: 4

Hello, you are my last hope! I have the following problem: I have a "Master.pdf" and a "Slave.pdf" which are on the same HD and in the same folder. I now open the "Master.pdf" and in this "Master.pdf" there is a button which should run a java code. And this code should simple insert the pages from the "Slave.pdf" into the opened "Master.pdf". I handled this by choosing this button with the object tool, saying "properties" and set "Javascript" as action to run. I read the whole questions and answers on this side but i found nothing comparable. I tried snippets of some Java Code but it doesn't work.
 
My used snippets are as follows:
 
function MergeMultipleFiles()
{
var doc = app.newDoc();
vFiles = new Array("/C/TestPDF/First.pdf","/C/TestPDF/Second.pdf","/C/TestPDF/Third.pdf");
for ( var i=0; i < vFiles.length; i++)
{
doc.insertPages ({nPage: doc.numPages-2,cPath: vFiles,nStart: 0});
}
 
and I tried the simple code:
 
this.insertPages({cPath: "test1.pdf"})
 
But both doesn't work. Anyone could help? I need this automation for my company.

My Product Information:
Acrobat Pro 8, Windows
pddesigner
Registered: Jul 9 2006
Posts: 858
Click this link, open the zip file (two PDF's), examine the codes in Acrobat, modify the codes as necessary.

Note: Do not use LiveCycle to examine the codes.

[url=http://wl.filegenie.com/~pdfmaker/catalog.zip]http://wl.filegenie.com/~pdfmaker/catalog.zip[/url]

My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.

prabudass
Registered: Aug 14 2008
Posts: 71
Above link not working. Kindly advise me. I need to merge the pdf files into single pdf via scripting.