Hi,
Would somebody please tell me what is wrong w/ my JavaScript?
var newDoc = app.newDoc(); //create a new PDF doc
newDoc.insertPages({nPage : -1, cPath : "/c/doc1.pdf",}); // inser doc1.pdf
newDoc.insertPages({nPage : newDoc.numPages, cPath : "/c/doc2.pdf",}); //insert doc2.pdf
newDoc.saveAs({ cPath : "/c/myNewDoc.pdf"}); //save new doc
newDoc.closeDoc(true); //close doc
I ran these on the batch processing from Adobe Pro 9.0 - it gave me the invalid argument type.
Doc.insertPages:13:Batch undefined:Exec ===> Parameter nPage.
I'm trying to merge the 2 PDF files using the sample script from Acrobat JavaScript Scripting Guide, but it doesn't work for some reason.
I can merged the 2 PDF files mannually, but not through script. I'm hoping that through scripting I can forced the Adobe XFA forms that I created from LCDesigner with the AcroForms. Merge the XFA forms & AcroForms together. I know that from manually it can't be merge. I just wonder if it can it be done through JavaScript? The doc1 & doc2 I have are regular AcroForms
Thanks a million for your help & suggestions
Trang
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Trang,
XFA forms (created in LC Designer) and AcroForms (created in Acrobat) are completely different animals!!!
The XFA form is wrapped up in a wrapper that runs in Acrobat/Reader. You cannot merge (afaik) an XFA form and a PDF (or AcroForm).
The best you will achieve is to attach an XFA form into a PDF.
Alternatively you can group XFA forms and PDF in a portfolio.
Good luck,
Niall
Views
Replies
Total Likes
Hi Trang,
XFA forms (created in LC Designer) and AcroForms (created in Acrobat) are completely different animals!!!
The XFA form is wrapped up in a wrapper that runs in Acrobat/Reader. You cannot merge (afaik) an XFA form and a PDF (or AcroForm).
The best you will achieve is to attach an XFA form into a PDF.
Alternatively you can group XFA forms and PDF in a portfolio.
Good luck,
Niall
Views
Replies
Total Likes
Hi Niall,
My original form is XFA form and I want to pull in (append) the AcroForms to XFA form. How would I do this? How would I attach the XFA form?
Thanks
Trang
Views
Replies
Total Likes
Hi,
Sorry, I mistook "merge". Yes you can attach a file ton XFA form. Here is a link to one of Paul's popular threads: Re: Upload / Attach File in form this link should lead you to the post that has Pauls's example.
Good luck,
Niall
Hi Niall,
Thanks for the Paul's link. From Paul's example I modified these in my LC Designer 8.2 & put these statements in docReady event.
var myDoc = event.target;
var sFile = "/C/ARP/Sample_Plot_Report";
myDoc.importDataObject ({cName: sFile});
myDoc.exportDataObject ({cName: sFile, nLauch:2});
It would prompt the user to select what file (Dialog box appear) even though I forced it with a path to load my file. It seem like no matter what path I change on my var sFile it doesn't work - look like it would default back to my current path that my file is on - why is that?? I don't want to prompt the user for the file. What I'm hoping for is that I can open this attach file & append this plot AcroForm file to my report which is XFA form PDF then renumber all the pages. Can this be done this way?
I was searching around & read up something about privileged & non privileged context & got all confused is my problem w/ the forceing the path related to this topic?
Thanks so much for any advice & guidance on my problems
Trang
Views
Replies
Total Likes
Hi Trang,
Paul would be better help here...
..but I think there are a few things going on here.
In Paul's original script "var sFile = myFile" + NumericField1.rawValue;" is to assign a bound variable to the attached file. So while the listbox displays the actual file name, it has a hidden bound value eg "myFile0".
So the other buttons/scripts are not accessing the file name of the attachments, but the bound values.
So your script "var sFile = "/C/ARP/Sample_Plot_Report";" will not work.
If you want to determine the actual file to be attached you could try adapting this variable:
var sFileName = myDataObject.path; //by setting a set path to the file
However I strongly suspect that the importDataObject is going to open the browser/explorer dialogue.
The import data objects is not a privileged function (afaik). So you don't need to develop a javascript folder level file. I think you are going to be stuck with the dialogue opening up each time the button is clicked.
When the attachment opens it will be in a new window. You will not be able to add pages from other documents into an XFA form.
Hope that helps,
Niall
Views
Replies
Total Likes
You cannot add something (whether it is an attachment, data or anything else) without the users knowledge, hence the user will get a prompt for these types of actions. If you run in a privaledged context then it is possible but that brings its own set of challenges to get all of your users in that context.
Paul
Hi Paul,
So if I run a privilege context then I might get rid of that open dialog in your example? Do you have an example script I can use. Thank you so much.
Trang
Views
Replies
Total Likes
No I do not .....I do not run privaledged commands.
Paul
Views
Replies
Total Likes
Hi,
Would some body help me w/ this error?
NotAllowedError: Security settings prevent access to this property or method.
From these scripts
doc = app.openDoc({ cPath: "/c/temp/doc1/doc1.pdf" })
aFiles = new Array( "doc2.jpg","doc3.pdf");
for (var i=0; i<aFiles.length; i++)
{
newDoc = app.openDoc({ oDoc: doc, cPath: aFiles[i], bUseConv: true })
newDoc.saveAs({ cPath: "/c/temp/empDoc.pdf" });
newDoc.closeDoc(true);
doc.insertPages({ nPage: doc.numPages-1, cPath: "/c/temp/tmpDoc.pdf", nStart: 0 });
}
These scripts worked, but when I replaced my doc1 w/ another pdf file and the security method is set to No Security for this properties and all other document restrictions summary for this are Allowed just like my other pdf files, but for some reason I have the NotAllowedError when I ran the same batch processing script. Help!
Thanks,
Trang
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies