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

No doc currently open in Viewer - Error at AFORMAUTLib.IAFormApp

H_nlm
Registered: May 12 2010
Posts: 9

I have a VB.Net VS 2005 app running succesfully with Adobe 7.0.5. On Upgradation to Adobe 9.0 the following error is thrown.

This opens a Template PDf with fields , puts values in fields and save the doc with a diff name.
I used acroApp.Show() in 9.3 to get rid of this error after avdoc.open.

Surprisingly, it doesn't throw error first time bu tit throws nxt time. This process generates number of documents from a template by filling in fields with diff values.

Dim l_oAVDoc As New Acrobat.AcroAVDoc
Dim l_oPDDoc As New Acrobat.AcroPDDoc
Dim objAcroApp As New Acrobat.AcroApp
Dim l_oFormApp As AFORMAUTLib.AFormApp
Dim l_oAcroFields As AFORMAUTLib.Fields
Dim l_oField As AFORMAUTLib.Field

Try
l_oAVDoc = CreateObject("AcroExch.AVDoc")
l_oPDDoc = CreateObject("AcroExch.PDDoc")
objAcroApp = CreateObject("AcroExch.App")
' Open the PDF file
bOpen = oAVDoc.Open("\\..")
'If everything was OK opening the PDF, we now instantiate the Forms
'Automation object.
If bOpen.Equals(True) Then
num = objAcroApp.GetNumAVDocs()
objAcroApp.Show()
oFormApp = CreateObject("AFormAut.App")
'get the fields collection
oAcroFields = oFormApp.Fields
Else
Console.WriteLine("Error")
End If

oField = oFormApp.Fields("Name")
oField.Value = DateTime.Now().ToString()

'Get the PDF document and save it
oPDDoc = oAVDoc.GetPDDoc

sPDFFilename = "\\..path" & Format(DateTime.Now(), "mm-dd-yy h-mi-ss") & ".pdf"

bOpen = oPDDoc.Save(PDSaveFull, l_sPDFFilename)

Catch ex As Exception
Console.WriteLine("Error:" & ex.Message)
Console.WriteLine("Error:" & ex.Message.ToString & " " & " " & ex.GetBaseException.ToString & _
ex.StackTrace.ToString())
Finally
'Close the AVDoc and PDDoc
objAcroApp.Hide()
oPDDoc.Close()
oAVDoc.Close(1)
objAcroApp.Exit()
If oFormApp IsNot Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oFormApp)
oFormApp = Nothing
End If
If oAVDoc IsNot Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oAVDoc)
oAVDoc = Nothing
End If
If oPDDoc IsNot Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oPDDoc)
oPDDoc = Nothing
End If

If objAcroApp IsNot Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(objAcroApp)
objAcroApp = Nothing
End If

End Try

oAcroFields = oFormApp.Fields -This line generates an error the second or third time this method is called.
No document is currently open in Viewer ...Event unable to invoke its subscribers at IAFormApp.getfields()

I have 9.3.2 and all the security updates.

Any assistance???

HN

My Product Information:
Acrobat Pro 9.3, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
What is the 'disclosed' property's value for the file being opened?

George Kaiser

H_nlm
Registered: May 12 2010
Posts: 9
Thanks for the prompt reply..

I am sorry. I am a beginner to Acrobat Forms and Can you let me know how should I check the disclosed property?
H_nlm
Registered: May 12 2010
Posts: 9
I have also executed the FormsAutomationVB sample from Adobe 9.0 samples which throws the same error. Please guide