I am trying to manipulate an adobe XML Form (Dynamic) using VB.net. Ultimately I want to put data into a template and save it. I am not sure if resolveNode is the best method to use, but nothing else seems to work. here are my problems...
1) resolveNode() yields a field object equal to Nothing
2) resolveNodes() seems to work, at least the field object gets set
3) Field.rawValue doesn't work - it produces an error indicating a property or method that it doesn't recognize.
4) I can manipulate a static form just fine, but I absolutely have tried everything to put data into a dynamic one and keep running into road blocks.
Dim app As Acrobat.CAcroApp
Dim pddoc As Acrobat.CAcroPDDoc
Dim js As Object
Dim Field As New Object
app = CreateObject("AcroExch.App")
pddoc = CreateObject("AcroExch.PDDoc")
If pddoc.Open("c:\Template.pdf") Then
js = pddoc.GetJSObject
If Not js Is Nothing Then
If js.dynamicxfaform Then
Field= js.xfa.resolveNodes("hh_FirstName")
Field.rawValue = "John"
End If
js.SaveAs("C:\Test.pdf")
End If
End If
To do this the JavaScript code must be placed in a folder level function, then the VB calls the function. That way all JavaScript operations are executed in the context of Acrobat, and there are no incompatiblilities.
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]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script