I'm having a problem with closing Acrobat. I'm using vb.net to sign a PDF file in running Acrobat. After I'm done I close Acrobat and try to delete the currently signed PDF file, but I get an error message telling me that file is being used by another process. I tried closing and setting to Nothing AcroApp, AcroAVDoc, AcroPDDoc JSO, but still that doesn't work. I tried releasing them with Marshal.ReleaseComObject(...) still no effect.
acroPDDoc.Close()
acrobatAVDoc.Close(False)
acrobatApp.Exit()
Try
Marshal.ReleaseComObject(javaScriptObj)
Catch ex As Exception
End Try
Try
Marshal.ReleaseComObject(acroPDDoc)
Catch ex As Exception
End Try
Try
Marshal.ReleaseComObject(acrobatAVDoc)
Catch ex As Exception
End Try
Try
Marshal.ReleaseComObject(acrobatApp)
Catch ex As Exception
End Try
javaScriptObj = Nothing
acroPDDoc = Nothing
acrobatAVDoc = Nothing
acrobatApp = Nothing
The alternative below that I do not want to use because it will kill all open PDF documents which I do not want.
'Gets All Acrobat Processes
Dim tProcess() As Process = System.Diagnostics.Process.GetProcessesByName("Acrobat")
'Kills Each Acrobat Process
For Each AcrobatProcess As Process In tProcess
AcrobatProcess.Kill()
Next
Please help me find a way around this. Thanks