PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

overlap lines in PDF generated document with PDF sharp
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1414
Page 1 of 1

Author:  djemmi [ Tue Nov 09, 2010 4:07 pm ]
Post subject:  overlap lines in PDF generated document with PDF sharp

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 4025 times ]

Author:  mikesowerbutts [ Wed Nov 10, 2010 9:30 am ]
Post subject:  Re: overlap lines in PDF generated document with PDF sharp

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

Author:  djemmi [ Fri Nov 12, 2010 1:11 pm ]
Post subject:  Re: overlap lines in PDF generated document with PDF sharp

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

Author:  mikesowerbutts [ Fri Nov 12, 2010 4:37 pm ]
Post subject:  Re: overlap lines in PDF generated document with PDF sharp

Hi David,

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

Author:  djemmi [ Fri Nov 19, 2010 4:28 pm ]
Post subject:  Re: overlap lines in PDF generated document with PDF sharp

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

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/