PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Jul 18, 2018 12:22 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Nov 08, 2017 4:30 pm 
Offline

Joined: Tue Nov 07, 2017 10:25 pm
Posts: 1
The cause of this issue was VS2008. When i made a second copy of my code referencing pdfsharp, it worked! The first copy must have been corrrupted in some way and it prevented release of the source files. I can say for sure now that the issue is resolved.

I am trying to use pdfsharp to write a pdf that contains text and images. I was doing really well until I ran into a problem related to the source images not being released after creating the pdf’s using ximage.

I have read through the forum and this is a pervasive thread and I do not believe there is a good answer so far. It is suggested in the posts that version 1.5 takes care of the problem but I have upgraded to version 1.5 from 1.3 and can say that it did not help. The problem exists in 1.5 as well.

I am not a c# programmer so I am using the Nuget download of Pdfsharp-gdi.dll - Version 1.50.4619.0

My environment is vs2008 and my code is in vb.net. It looks like this

Dim s3image As XImage = XImage.FromFile("saved2.bmp")

gfx1.DrawImage(s3image, 20, 65, 241, 185)
‘add more elements to the pdf here‘
s3image.Dispose()

The above code works – the image is produced on the pdf. However, after running this code I can’t delete. rename or overwrite the ‘saved2.bmp’ because it is now locked.

Am I missing something? Or does anyone have a ximage.fromstream example I could follow?
I can send an example vb.net project with this issue if that would be of help. It sounds like it is a well known issue in the community hopefully with a well known solution.


Last edited by miken99 on Thu Nov 09, 2017 3:13 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 08, 2017 9:34 pm 
Offline
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 381
Location: CCAA
Hi!

IIRC there was a problem with the WPF build 1.32 not releasing image files. This problem was resolved with version 1.50.
So maybe try the WPF build.

If you are using images from temporary files: Why not use MemoryStream instead of a temporary file? No problem with file locks and better performance.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 4 guests


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 post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group