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

Call Java Script function from C# code

amarkumarv
Registered: Apr 16 2007
Posts: 6

When two pages having bar codes are merged into a single PDF document, the resultant PDF document does not display the barcode if we use any third party tools.
 
Using Acrobat JavaScript, I am able to merge the documents with barcode.
 
The following is the code which I wrote at folder level, I am using to merge the files:
MergeFiles = app.trustedFunction(function(vFile,vFilesToMerge)
{
app.beginPriv();
var doc = app.newDoc();
for(var i = 0; i < vFilesToMerge.length; i ++)
{
doc.insertPages ({nPage: doc.numPages-2,cPath: vFilesToMerge[i],nStart: 0});
}
doc.saveAs({cPath: vFile});
doc.closeDoc(true);
app.endPriv();
});
 
Could you please provide the answers to the below questions?
1. When I tried to merge the PDF files from the above code, it is creating a blank page at the beginning of the document. How can this be avoided?
2. The code I am using is correct or will it cause any other issues?
3. How can I call Acrobat Javascript from C# code, since I need to select multiple files and merge the same into one pdf document from C# application?

My Product Information:
Acrobat Pro 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Already Answered

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