Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
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 18:17pm

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

  Print Answers RSS
0 DamithSL 325
1 Maciej Los 217
2 OriginalGriff 213
3 BillWoodruff 79
4 Jose Garcia Sevilla 75
0 OriginalGriff 7,953
1 DamithSL 6,139
2 Sergey Alexandrovich Kryukov 5,454
3 Maciej Los 5,293
4 Kornfeld Eliyahu Peter 4,539

Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 12 Jun 2012
Copyright © CodeProject, 1999-2014
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