Quite some time ago I wrote a little utility which printed all the form field and their properties.  This was done back in the days of Acrobat 4 but I just tried it and it still runs fine with Acrobat 6, VB6 SP5, and XP Pro SP1.

 

Here is the code that opens up the form and iterates through the fields:

 

************* BEGINNING OF CODE ********************

Dim AcroExchAVDoc As CAcroAVDoc

Dim AcroExchApp As CAcroApp

Dim AFormAut As AFORMAUTLib.AFormApp

Dim Field As AFORMAUTLib.Field

Dim Fields As AFORMAUTLib.Fields

Dim OK As Boolean

Dim Filename As String

Dim FieldName As String

 

Private Sub Command1_Click() 

              Filename = "a.pdf"

              Set AcroExchApp = CreateObject("AcroExch.App")

              Set AcroExchAVDoc = CreateObject("AcroExch.AVDoc")

              OK = AcroExchAVDoc.Open(App.Path & "\" & Filename, "")

              Set AFormAut = CreateObject("AFormAut.App")

 

              Set Fields = AFormAut.Fields  

  

              For Each Field In Fields

' Insert the code that will process each field

FieldName = Field.Name    ‘ save off the field name

              Next

       

              AcroExchAVDoc.Close (True)

              Set AcroExchApp = Nothing

              Set AcroExchAVDoc = Nothing

End Sub

**************** END OF CODE ***********************

 

Pete

 

---------------------------------------------------------------
Pete Koolish                              1036 Whitebick Drive
Consultant                                 San Jose, CA  95129
The PDF Group                       408.446.3156
---------------------------------------------------------------

     

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yehuda Rosenblum
Sent: Wednesday, August 06, 2003 9:50 AM
To: [EMAIL PROTECTED]
Subject: [PDFdev] Reading the Fields through the Automation object.

 

 

PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com

_____________________________________________________________

 

I am writing a proigram in VB (version 6.0 sp 5) that is attempting to

read through the field on a PDF with the AFORMAUTLib class Fields.  The

documentation says that it has a _NewEnum and therefore supports a call

such as For Each Field in Fields (in fact this is the only way I can see

to loop through the fields using VB 6.0).  This call worked fine in

Acrobat 4.0 and 5.0.  However, when I upgraded to 6.0 I get the

following Error:

 

Automation error

Invalid access to memory location.

 

The object can see how many fields, but the _NewEnum property causes an

Automation Error.  Does anyone know if something changed in Acrobat 6.0

that disables this functionality?  If so, is there any way to loop

through the fields?

 

Thanks,

Yehuda Rosenblum

 

To change your subscription:

http://www.pdfzone.com/discussions/lists-pdfdev.html

 

 

Reply via email to