You are not logged in.
Pages: 1
Hello, thanks for this library. In this piece of code:
lPDf:=TPDFDocumentGDI.Create;
try
lPage := lPDF.AddPage;
lPage.PageWidth:=413;
lPage.PageHeight:=556;
with lPDF.VCLCanvas do
begin
mmode:=SetMapMode(Handle,MM_ANISOTROPIC);
SetWindowExtEx(Handle,413,556,@oldwi);
SetViewportExtEx(Handle,Round(((413/2.835)*96)/25.4),
Round(((556/2.835)*96)/25.4),@oldvi);
p:=Point(0,16);
DPtoLP(Handle,p,1);
Font.Height:=-p.Y;
Font.Name:='Arial';
s:='any string with four spaces';
GetTextExtentPoint32(Handle,PChar(s),Length(s),sz);
SetTextJustification(Handle,393-sz.cx,4);
TextOut(10,10,s);
SetTextJustification(Handle,0,0);
SetViewPOrtExtEx(Handle,oldvi.cx,oldvi.cy,nil);
SEtWindowExtEx(Handle,oldwi.cx,oldwi.cy,nil);
SetMapMode(Handle,mmode);
end;
As you see, in setviewport I transform the window extensions to the values in pixels, taking in account the values in the procedure: SetDefaultPaperSize in synpdf.pas.
sz.cx seems to report the correct amount and the font seems to be of the good size, so why SetTextJustification does nothing and the result is correct but without justification? Very appreciated, cheers.
Offline
Thank you.
Offline
Pages: 1