Hello. I am trying to open an existing PDF document, Enter text into a particular form field, then save to a different name. I have found documentation on the ObjectAttribute function, but my question is How do I get the existing Form Field object without using Coordinates or creating a new one? Is there a way to get this object by its' name?
I am using the evaluation version of PDF Creator - Developer.
Thank You!!
Editing Form Fields in an existing document
Hello,
Please find here a snipet of code that retreive from a pdf file all the objects of type Field and return their attributes:
-----------------------------------------------------------------------------------
Private Sub cmdLoop_Click()
Dim obj As Variant
Dim objarray As Variant
PDF1.SetLicenseKey LicenseTo, ActivationCode
PDF1.Open "c:\temp\test.pdf", ""
'get all array of objects in Page[1]
objarray = PDF1.ObjectAttribute("Pages[1]", "Objects")
'Gets all the object type number 5 and retrieve information about them
For Each obj In objarray
DoEvents
If obj.Attribute("ObjectType") = 6 Then ' returns the object reference
MsgBox ("Right: " & obj.Attribute("Right") & vbNewLine & _
"Left: " & obj.Attribute("Left") & vbNewLine & _
"Bottom: " & obj.Attribute("Bottom") & vbNewLine & _
"Top: " & obj.Attribute("Top") & vbNewLine & _
"TextFont: " & obj.Attribute("TextFont") & _
"Name: " & obj.Attribute("Name"))
End If
Next
End Sub
--------------------------------------------------------------------
You can find more information about objects type and attribute on pages 25 - 26 of the Developers' manual "Amyuni PDF Creator.pdf"
Regards.
Please find here a snipet of code that retreive from a pdf file all the objects of type Field and return their attributes:
-----------------------------------------------------------------------------------
Private Sub cmdLoop_Click()
Dim obj As Variant
Dim objarray As Variant
PDF1.SetLicenseKey LicenseTo, ActivationCode
PDF1.Open "c:\temp\test.pdf", ""
'get all array of objects in Page[1]
objarray = PDF1.ObjectAttribute("Pages[1]", "Objects")
'Gets all the object type number 5 and retrieve information about them
For Each obj In objarray
DoEvents
If obj.Attribute("ObjectType") = 6 Then ' returns the object reference
MsgBox ("Right: " & obj.Attribute("Right") & vbNewLine & _
"Left: " & obj.Attribute("Left") & vbNewLine & _
"Bottom: " & obj.Attribute("Bottom") & vbNewLine & _
"Top: " & obj.Attribute("Top") & vbNewLine & _
"TextFont: " & obj.Attribute("TextFont") & _
"Name: " & obj.Attribute("Name"))
End If
Next
End Sub
--------------------------------------------------------------------
You can find more information about objects type and attribute on pages 25 - 26 of the Developers' manual "Amyuni PDF Creator.pdf"
Regards.