Click here to Skip to main content
12,997,185 members (73,624 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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.[^]

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
           pagecount = pdfdoc.PageCount
             pdfdoc.ExportText(TempFile, 1, pagecount, True, True)
            If File.Exists(TempFile) Then
                strl_RetVal = System.IO.File.ReadAllText(TempFile)
            End If
            strl_RetVal = RemoveWhitespace(strl_RetVal) ' Remove white space
          Catch aveEx As System.AccessViolationException
            'release object from memory
        End Try
    Return strl_RetVal
    End Function
Posted 12-Jun-12 17:17pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 12 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100