#1 2016-06-29 11:42:19

SotircaMihai
Member
Registered: 2016-06-29
Posts: 2

PDF text clipping not working

We have a generic library to print (either to printer, pdf, eml...) and use windows api DrawText to write text. If the specified rectangle width is smaller than the needed width the text is not clipped. If we use the DT_WORDBREAK format then the clipping is done.

ex: (font - Arial size 8)

fPDF := TPdfDocumentGDI.Create;
fPDF.EmbeddedTTF := True;
fPDF.DefaultPaperSize := psA4;
fPDF.PDFA1 := True;

vText := 'This is a random text!';
vRect.Left := 50;
vRect.Top := 200;
vRect.Right := 350;
vRect.Bottom := 216;
vFormat := DT_EXTERNALLEADING or DT_NOPREFIX or DT_LEFT;

DrawText(fPDF.VCLCanvas.Handle, pChar(vText), Length(vText), vRect, vFormat )

woks fine, but if i reduce the rectangle width (vRect.Right := 65;) it doesn't!

Offline

#2 2016-06-29 11:57:18

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

Re: PDF text clipping not working

Which revision of the library are you using?
Latest number is 1.18.2762.

Offline

#3 2016-06-30 13:55:14

SotircaMihai
Member
Registered: 2016-06-29
Posts: 2

Re: PDF text clipping not working

Thank you for the fast reply. My revision is '1.18.2760'.

Offline

Board footer

Powered by FluxBB