#1 2014-10-10 11:06:30

adriany
Member
Registered: 2014-07-25
Posts: 12

SynPDF DRAW_TEXT bug

Hello,

I think I have found a bug in your excellent SynPDF components.

I am using DRAW_TEXT with nothing special only DT_NOPREFIX and DT_WORDBREAK. In an older version of SynPDF, from 11 September 2013 everything works fine. But the latest version of SynPDF seems to draw text that contains spaces incorrectly. Instead of one space I get many spaces and the text is spread out across the page.

The bug occurs in TPdfEnum.TextOut because if I replace this procedure with code from the older version from 11 September 2013 then it all works again. So it is something to do with the code changes relating to disabling text clipping and I think the problem is when you save and restore the canvas.

Just try creating a PDF using DrawText with some text that has spaces in it.

Anyway just thought I would let you know.

AY

Offline

#2 2014-10-11 08:20:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: SynPDF DRAW_TEXT bug

What is the bug?
What is the regression, at source code level?
What was the modification which made the difference?
Did you make some investigation?

Such a complex library than SynPDF, with potentially a lot of diverse input (sometimes generated by third party reporting tools), is very hard to maintain.
Even metafile (.emf) content is not enough to understand what it produces.
Just one modification may break your expectation, but be in fact much better for other users...
It is hard to guess what happens, and what should be done, in all the potential use cases of the library.
We need you to investigate a bit further... smile

Offline

#3 2015-02-06 10:24:10

cocce
Member
Registered: 2011-11-02
Posts: 28

Re: SynPDF DRAW_TEXT bug

hi, I have similar problem using SynPdf and right align text when text contains space (1 or more).

When the text is printed out the last char of the line is cutted.

Seems the output rect has a wrong dimension when a space is presente.

iFormat := DT_EDITCONTROL or DT_WORDBREAK or DT_NOPREFIX or DT_RIGHT;

DrawText(FCanvas.Handle, PChar(AText), Length(AText), ABounds, iFormat);

I tryed with just DT_RIGHT and I have same problem.

iFormat := DT_RIGHT;


Any ideas, may I try to do something to investigate?

I attach 2 screenshots.

* Pagina 1.pdf - The original text is "06/02/2015 10:58:29[CR]ciao[CR]ciao 3[CR]ciao_3"
* Copertina.pdf - The original text is "06/02/2015 11:04:15"


Ps. I tried changing TPdfDocumentGDI.UseMetaFileTextPositioning using tpExactTextCharacterPositining and the problem seems fixed.

Regards
Cocce

Last edited by cocce (2015-02-06 11:01:51)

Offline

#4 2015-02-25 14:25:39

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: SynPDF DRAW_TEXT bug

I have a similar problem, after upgrade the framework when try to use DrawText I get problem.

This is my code:

                    temp := 'Tale atto viene presentato per riportare in mappa n. 2 fabbricati non presenti. I fabbricati sono stati costruiti prima del 1967 come dichiarto dal propritario sottoscrivente. Il presente tipo non ha valenza di frazionamento.';
                    r.Left := 65;
                    r.Right := lPdf.VCLCanvasSize.cx-65;
                    r.Top := vpos;
                    r.Bottom := lPdf.VCLCanvasSize.cy-50-vpos;

                    DrawText(lPdf.VCLCanvas.Handle, PChar(temp), Length(temp), r, DT_END_ELLIPSIS or DT_NOPREFIX or DT_WORDBREAK or DT_EDITCONTROL);

and this is the result:
https://www.dropbox.com/s/bxsfyhxdvbsox … 1.png?dl=0

besides as you can see on next image if I try to select the text and copy it the text is correct,  there is a part of text outside the page:
https://www.dropbox.com/s/4clzfjljtsxy2 … 2.png?dl=0

I have try to use tpExactTextCharacterPositining like cocce but I get the same result.

Any idea?

Thanks

Offline

#5 2015-02-27 23:48:33

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: SynPDF DRAW_TEXT bug

After some test I have a new. In my case the problem is the second DrawText call.
For any page of my PDF only the first DrawText is draw without problem, the second is draw but I cannot see the text, only if select it and copy into blocknote I can see it.

Any idea?

Thanks

Offline

#6 2015-02-28 09:26:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: SynPDF DRAW_TEXT bug

Clipping issue?

Offline

#7 2015-02-28 22:29:16

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: SynPDF DRAW_TEXT bug

ab wrote:

Clipping issue?

Some more information?

Offline

Board footer

Powered by FluxBB