Hi
I will try to explain what I need!
I created a file called test.xml
I have to import this file when the PDF is opened. The xml file is in the same folder that the PDF file. The XML is well-formed.
The imported file should be converted to a string. This string I will use with XMLData.parse() to fil a form in the PDF document.
Can anybody help me creating this script to me? I dont know how to import the file and I donk know how to convert the file to a string.
Thanks. It will save my job!
Alex
1. Import the XML as a Data Object. Then get the contents and parse.
2. Convert the XML to "xfdf" which Acrobat already understands. Use the "importAnXFDF" function. When the file is imported it is automatically parsed and the data placed in the appropiate fields.
Both methods are problematic. If this is expected to be done with Reader, then the form has to have special Reader Rights Enabling that can only be purchased from Adobe. Also, whether it's being done from Reader, Standard, or Professional, using JavaScript to import data into a PDF can only be done from a privileged context.
If you're only doing this from Acrobat Pro and you can put a folder level script on the user's system then either of these two methods will work.
But there are other ways to get data into a form. For example, you can silently import an FDF file into a PDF, even when it is displayed in Reader, and it doesn't require privilege or any special enabling. You cannot do this with any other data format. In fact, there is a import data action for bookmark and button events that will only use FDF. If you can convert your XML data into FDF, then things get easier.
Both XFDF and FDF can contain references to the PDF file. So double clicking on one, or dragging and droping one of these file types into Acrobat/Reader will automatically load the associated PDF and merge in the data. Again, no special privilege or Rights Enabling is needed. If you can open the files this way things are much easier.
Data handling can get wierd and complex, but there are lots of options.
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]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script