• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

How to release PDF immediately?

New Here ,
Jan 21, 2019 Jan 21, 2019

Copy link to clipboard


I will extract the note in PDF file.

When calling Acrobat API from VB.NET, the file will remain open and locked. Also, if I check the task manager, the Acrobat process may not finish, there may be a considerable time lag by the end.

In the code, it seems that PDF has been opened in Acrobat even though processing to close PDF is included.

It is OK even if Acrobat is left in the process, but I want to realize the process of closing the file immediately and releasing the lock as soon as the use of the file is over. What kind of code should be assembled to start Acrobat hidden in VB.NET and close the file opened with AcroPDDoc?

sample code :

    Private Function GetNoteOnPDF(ByVal filepath As String) As String

        GetNoteOnPDF = ""

        Dim objAcroApp As New Acrobat.AcroApp

        Dim objAcroPDDoc As New Acrobat.AcroPDDoc

        Dim objAcroPDPage As Acrobat.AcroPDPage

        Dim objAcroPDAnnot As Acrobat.AcroPDAnnot

        Dim lRet As Boolean

        Dim note As String = ""


            lRet = objAcroApp.Hide()

            If lRet = False Then

                Exit Function

            End If

            lRet = objAcroPDDoc.Open(filepath)

            If lRet = False Then

                Exit Function

            End If

            For i As Integer = 0 To objAcroPDDoc.GetNumPages - 1

                objAcroPDPage = CType(objAcroPDDoc.AcquirePage(i), Acrobat.AcroPDPage)

                For j As Integer = 0 To objAcroPDPage.GetNumAnnots() - 1

                    objAcroPDAnnot = CType(objAcroPDPage.GetAnnot(j), Acrobat.AcroPDAnnot)

                    With objAcroPDAnnot

                        Select Case .GetSubtype

                            Case "Text"

                                note += .GetContents

                        End Select

                    End With

                Next j


            Return note

        Catch ex As Exception

            MessageBox.Show("error :" & ex.Message)




            lRet = objAcroApp.Exit

            objAcroPDAnnot = Nothing

            objAcroPDPage = Nothing

            objAcroPDDoc = Nothing

            objAcroApp = Nothing

        End Try

    End Function

Acrobat SDK and JavaScript






Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation