These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Form automation with PDF's created in Livecycle

michelleny914
Registered: Sep 1 2009
Posts: 11

Hi,
 
I'm having a issue getting the fields from a PDF file created in Livecycle. I get the following error once I access a field:
 
Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))
 

 
Is it possible to use the OLE API's to retreive the fields in the Livecycle form? Here is the code in question:
 

 
Public Function FillForm(ByVal patient As clsPatient, ByVal isNew As Boolean, Optional ByVal CompletionDate As Date = #1/1/1900#) As String Implements iPDFProcess.FillForm
Dim ds As New DataSet
Dim dr As DataRow
Dim NewFile As String
Dim formApp As AFORMAUTLib.AFormApp
Dim bOK As Boolean
Dim avDoc As Acrobat.CAcroAVDoc
Dim pdDoc As Acrobat.CAcroPDDoc
 

 
Try
'Set the mouse icon to display an hourglass
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
If isNew = False Then
ds = GetData(PatientId, CompletionDate)
If ds.Tables(0).Rows.Count > 0 Then
dr = ds.Tables(0).Rows(0)
End If
End If
avDoc = CreateObject("AcroExch.AVDoc")
 

 
bOK = avDoc.Open(lTemplateFileName, "NB")
avDoc.Maximize(1)
formApp = CreateObject("AFormAut.App")
If isNew = True Then 'Only fill Demographic data
formApp.Fields("PatientId").value = patient.PatientId
formApp.Fields("DateCompleted").value = Format(Now(), "M/dd/yyyy")
formApp.Fields("PatientName").value = patient.LastName & ", " & patient.FirstName
end if
 
The rest of the code is not shown to save room.
 

 
As soon it tried to access a field I get the above error. I also have a problem with the following code in another section of my code (for another PDF form). Here is a segment of the code:
 
avDoc = CreateObject("AcroExch.AVDoc")
 

 
bOK = avDoc.Open(lTemplateFileName , "NB")
avDoc.Maximize(1)
formApp = CreateObject("AFormAut.App")
acroForm = formApp.Fields
If isNew = True then
For Each f As AFORMAUTLib.Field In acroForm
Select Case f.Name
Case "PatientName"
f.Value = patient.LastName & ", " & patient.FirstName
Case "Gender"
f.Value = patient.Gender
Case "DateCompleted"
f.Value = format(Now(), "M/dd/yyyy")
Case "PatientId"
f.Value = patient.PatientId
Case "DOB"
f.Value = patient.BirthDate
End Select
Next
Else
 

 
It always passes right over the loop as it it can't find the fields. What up with that. Thanks for any help that you can provide.

My Product Information:
Reader 9.0, Windows
michelleny914
Registered: Sep 1 2009
Posts: 11
Apparently the IAC api's will not work with livecycle forms. I just recreated the pdf file in Acrobat alone, and it now works. But this leaves me with other issues such as:

1. How can I represent a Date picker field?

2. A few of our forms created in Livecycle use dynamic forms. I.E. Hiding pages until a checkbox is selected for example. Is it possible to get similar results with just Acrobat/reader?



Thanks for any suggestion or comments.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You access the Acrobat JS object, just as LiveCycle forms converted to a PDF do. You will need to reverence field names by their full path accessor description. Calling LiveCycle Designer functions is not possible and dynamic forms are not possible by Acrobats JS API. Remember a LiveCycle Designer form is an XML form wrapped within some PDF structuring code to allow display and limited interaction between Acrobat and the XML code.

As to a calendar picker see FormRouter's free form field editor toolbar addon. This product can add additional code to add a calendar date picker button to an associated date text field. It adds hidden form fields and close to a thousand lines of JavaScript code to your form.

George Kaiser