C# version - does it implement autoclosable at all? It locks the file when encontering a corrupt pdf...

trevor
2013-09-09
2015-02-22
  • trevor

    trevor - 2013-09-09

    Hi folks,

    I see the java version is mentioned that functions auto close, but does this happen in the c# version?

    I am having an issue as follows:

    All my program should do is simply create the File object, like:

    org.pdfclown.files.File mainFile = new org.pdfclown.files.File(fileName)

    Then sometimes there is a corrupt pdf in my list of files, and Itry to catch the exception and move that file to a "bad pdf folder".

    The problem is that when I go to move the file, I am getting an IOException saying that the file is already used by another process.

    I have used many combinations of "using", and disposing of everything, etc. but I simply cannot seem to get org.pdfclown.files.File to release the file without completely exiting the program.

    Catching the ParseException of org.pdfclown does work, I can increment my bad file count and move on to the next files in the folder - but later when I go to my routine to move the bad files, I cannot get the file unlocked.

    Any advice please?

    Thanks kindly!

    Trev

     
  • Equalizer

    Equalizer - 2015-01-06

    Hi Trevor,

    I know this is an older post but it still deserves an answer.

    the C# version does not auto close files so you have to use mainFile.Dispose() before using System.IO.File to manipulate the file, this will force the file to be closed and you can then do with it as you wish.

     
  • Stefano Chizzolini

    Hi Trevor and Equalizer,

    I integrated Kasper Fabæch Brandt's patch on 0.1.2-Fix branch (rev 151) and 0.2.0 trunk (rev 152): now the problem is solved.

     
    Last edit: Stefano Chizzolini 2015-03-09

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks