View previous topic :: View next topic |
Author |
Message |
golan
Joined: 01 Jul 2008 Posts: 3
|
Posted: Tue Jul 01, 2008 8:11 am Post subject: MigraDoc Tables.Cell.AddImage(string fileName) bug |
|
|
Code: | MigraDoc.DocumentObjectModel.Tables.Cell.AddImage(string fileName) |
This function leaves the image stream open which makes it impossible to delete the image file while the app is still running!
Why don't you implement a constructor of Image class with a stream parameter instead of (or in addition to) the path parameter?
I have all my images stored in a databese as byte[].
I have to save them as image files,
then build the pdf file
and then when i try to clean up and delete the images
i get an exception that the files are still in use.
even though the pdf file is already closed.
the bug is not in my code because when I save the byte[] to image files
and skip the part when I add the image to the pdf,
all images are successfully deleted.
Other than that I wish to thank you for this wonderful tool. |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: Mon Jul 14, 2008 8:29 am Post subject: |
|
|
MigraDoc needs a file - this is by design.
We could accept a stream parameter and create a temporary file internally.
Images are cached. They will be included only once in the PDF file even if they appear at multiple locations.
This cache persists even if the PDF file is closed.
This cache would not work (or would require special treatment) with files created from streams.
But I do hope that the file handle will be closed if you dispose the PDFsharp and MigraDoc objects (you may have to call GC.WaitForPendingFinalizers()).
Sorry, but I don't have time to test this right now. _________________ Regards
Thomas Hoevel
PDFsharp Team |
|
Back to top |
|
|
|