-
1. Re: How to merge two PDF
try67 Jan 21, 2013 4:01 AM (in response to SathishVelu)You're not using correct path syntax.
To see what is the correct path syntax of a file, open it and then execute
this code in the JS console:
this.path
-
2. Re: How to merge two PDF
SathishVelu Jan 21, 2013 4:18 AM (in response to try67)Thanks for your reply,
Here I have pasted the code with correct path
// Create a new PDF document:
var newDoc = app.newDoc();
// Insert doc1.pdf:
newDoc.insertPages({
nPage : -1,
cPath : "/D/doc1.pdf",
});
// Insert doc2.pdf:
newDoc.insertPages({
nPage : newDoc.numPages,
cPath : "/d/doc2.pdf",
});
// Save the new document:
newDoc.saveAs({
"/d/myNewDoc.pdf");
});
The above coding is taken from AcroJSGuide.pdf file
Still same error message is coming, not working
Thanks
-
3. Re: How to merge two PDF
Test Screen Name Jan 21, 2013 4:31 AM (in response to SathishVelu)When you use this form for parameters you can list them in order:
method(value1,value2,value3)
When you use this form for parameters you must give them names:
method( { name1:value1 , name2:value2 , name3:value3 } ) ;
The difference is the { }. Notice that in the line with the problem you start out as if it is the second form but end up without a name as if it is the first form. Yes, the example in AcroJSGuide.pdf is wrong.
AcroJSGuide.pdf belongs to Acrobat 7, and is 8 years old. Unless you are forced to develop with this ancient and unsupported version, I recommend you get a more recent Acrobat SDK (which fixes the error too). This is the Acrobat X SDK documents online: http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp. htm?&accessible=true
-
4. Re: How to merge two PDF
try67 Jan 21, 2013 4:47 AM (in response to SathishVelu)Also, there's an extra closing bracket ")" in the last saveAs command, which you need to remove.
-
5. Re: How to merge two PDF
SathishVelu Jan 21, 2013 10:23 PM (in response to try67)Thanks for your replies, i finally made it
Here is the updated coding to merge 2 pdf using acrobat javascript
// Create a new PDF document:
var newDoc = app.newDoc();
// Insert doc1.pdf:
newDoc.insertPages({
nPage : -1,
cPath : "/d/sathish/1.pdf",
});
// Insert doc2.pdf:
newDoc.insertPages({
nPage : newDoc.numPages-1,
cPath : "/d/sathish/2.pdf",
});
// Save the new document:
newDoc.saveAs("/d/sathish/myNewDoc.pdf");
Thanks & Regards
Sathish V.




