PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MigraDoc Tables.Cell.AddImage(string fileName) bug

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Bug Reports - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
golan



Joined: 01 Jul 2008
Posts: 3

PostPosted: Tue Jul 01, 2008 8:11 am    Post subject: MigraDoc Tables.Cell.AddImage(string fileName) bug Reply with quote

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
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Mon Jul 14, 2008 8:29 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Bug Reports - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com