hi everyone
i would like some help with the application that we developed.
this is for our office use only, and what our app is doing is extracting the text from the pdf file using pdflibnet.dll
but we lately encountered a problem with a particular pdf file.
the problem is when we try to pdfdoc.load(strFileLocation) there is an error.
below is the sample code/function that we have so far.
And System.IO.File.Delete(TempFile) will stop the application from running.
"The process cannot access the file 'D:\temp\test2.pdf' because it is being used by another process."
i would like to attach the pdf file but here but there is no way for me to attch it here.
so here is the DL link from other fileservers.
http://www.rarefile.net/esbjcrhn4iek/test.pdf[
^]
Public Function ExtractPDF(ByVal strl_File As String) As String
Dim strl_RetVal As String = ""
Dim TempFile As String = System.IO.Path.GetTempPath & Now.Ticks & ".txt"
Dim pdfdoc As PDFLibNet.PDFWrapper = New PDFLibNet.PDFWrapper
Dim pagecount As Integer = 0
Try
pdfdoc.LoadPDF(strl_File)
pagecount = pdfdoc.PageCount
pdfdoc.ExportText(TempFile, 1, pagecount, True, True)
If File.Exists(TempFile) Then
strl_RetVal = System.IO.File.ReadAllText(TempFile)
System.IO.File.Delete(TempFile)
End If
strl_RetVal = RemoveWhitespace(strl_RetVal)
Catch aveEx As System.AccessViolationException
MsgBox(aveEx.Message)
Finally
pdfdoc.Dispose()
End Try
Return strl_RetVal
End Function