Copy link to clipboard
Copied
Here is my code.
Public Function GetPDFLastTwentyText(ByVal pstrPdfFilename As String) As String
Dim PDDoc As Object
Dim CAcroRect As New Acrobat.AcroRect
Dim PDPage As Acrobat.AcroPDPage
Dim PDTxtSelect As Acrobat.AcroPDTextSelect
Dim CArcoPoint As Acrobat.AcroPoint
Dim iNumWords As Integer
Dim iMax As Long
Dim arPdfLines() As String
Dim i As Integer
Dim fso As FileSystemObject
GetPDFLastTwentyText = ""
Set fso = New FileSystemObject
If fso.FileExists(pstrPdfFilename) Then
Set PDDoc = CreateObject("AcroExch.PDDoc")
PDDoc.Open pstrPdfFilename
Set PDPage = PDDoc.AcquirePage(PDDoc.GetNumPages() - 1)
Set CArcoPoint = PDPage.GetSize()
CAcroRect.Top = CArcoPoint.y
CAcroRect.Left = 0
CAcroRect.Right = CArcoPoint.x
CAcroRect.bottom = 0
Set PDTxtSelect = PDDoc.CreateTextSelect(PDDoc.GetNumPages() - 1, CAcroRect)
...
PDDoc.Close
End If
Set fso = Nothing
Set PDTxtSelect = Nothing
Set CAcroRect = Nothing
Set CArcoPoint = Nothing
Set PDPage = Nothing
Set PDDoc = Nothing
End Function
I have no idea to use this API.
Although I call API directly "PDPageRelease (PDPage
)" in my code, it will get error that it can't find this API.
That is part of the plugin API. You cannot use this in an external app. Why do you want to use it? (In a plugin it is vital, yes)
Copy link to clipboard
Copied
That is part of the plugin API. You cannot use this in an external app. Why do you want to use it? (In a plugin it is vital, yes)
Copy link to clipboard
Copied
Because I want to delete the pdf file, the pdf file will lock after this program.
So i can't use this api "PDPageRelease()" just like other api "AcquirePage()
" ?
Copy link to clipboard
Copied
If you want to delete the file, its best to quit Acrobat.