PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jul 14, 2024 9:36 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Nov 09, 2010 4:07 pm 
Offline

Joined: Tue Nov 09, 2010 2:56 pm
Posts: 3
Hi,

We have a strange behaviour with the use of PDF sharp.
We generate a PDF file containing only text (either in bold or italic) using the "MeasureString" and "DrawString" functions.
Sometimes, the generated file contains overlaped lines : it can be at the begining of the file, in the middle or at the end (ramdom place in fact).
The problem is hardly reproducible (sometimes once every 10 generated files), and sometimes the same generated file is OK.

You can find the problem screenshot in the attached file.

Is it a bug ?
Did anybody had the same problem ?
How did you fix it ?

Thanks for your help.

David

Attachment:
probelem pdf.JPG
probelem pdf.JPG [ 17.05 KiB | Viewed 4021 times ]


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 10, 2010 9:30 am 
Offline
Supporter

Joined: Fri May 15, 2009 3:28 pm
Posts: 96
Hi David,

I would suggest using migradoc for text layout as thats what its really meant for. However I know with pdfsharp, when drawing text, you have the option to specify a rectangle in which to draw the text. Are you currently doing this? if so maybe make it taller?

Also, you mention it is difficult to replicate - does that mean that you produce exactly the same pdf (i.e. same text etc. contained within) twice and it occurs in one, but not the other?

Thanks,

Mike


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 12, 2010 1:11 pm 
Offline

Joined: Tue Nov 09, 2010 2:56 pm
Posts: 3
mikesowerbutts wrote:
Hi David,

I would suggest using migradoc for text layout as thats what its really meant for. However I know with pdfsharp, when drawing text, you have the option to specify a rectangle in which to draw the text. Are you currently doing this? if so maybe make it taller?

Also, you mention it is difficult to replicate - does that mean that you produce exactly the same pdf (i.e. same text etc. contained within) twice and it occurs in one, but not the other?

Thanks,

Mike


Hi Mike,

Thanks for your help.

We can't use migradoc in our application because it has been developped with Silverlight technology. The PDF generation is done on the client side.
We specify the rectangle drawing area : we'll check if the dimension is not too small.
Indeed, the problem can appear when we generate exactly the same PDF : 9 times it's OK, and the 10th it contains the bug.
Maybe a memory problem (read/write in a array not correctly sized) ?

Thanks in advance for your reply or ideas.

David


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 12, 2010 4:37 pm 
Offline
Supporter

Joined: Fri May 15, 2009 3:28 pm
Posts: 96
Hi David,

no worries. Unfortunately i dont have a clue why that would be going wrong - maybe it is a bug...


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 19, 2010 4:28 pm 
Offline

Joined: Tue Nov 09, 2010 2:56 pm
Posts: 3
Bug fixed !

The bug is in the MeasureString function : suddenly this function returns "0" instead of the right value, and it returns null everytime you call it within the PDF generation.

We just put a test on the returned value and used a default value if the function fails.

David


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 26 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