Hello,
the Unit "fpPDF" (C:\lazarus\fpc\3.2.0\source\packages\fcl-pdf\src) has a constant "cDefaultDPI" set to 72.
but when using Screen.PixelsperInch i get 96.
When Using functions like this:
function PDFTomm(APixels: TPDFFloat): Single;
begin
Result := (APixels * cInchToMM) / cDefaultDPI;
end;
i do not get the correct value for this:
PDFTomm(lFC.TextWidth(Tx, fFontSize))
if i use the correct DPI Value i get the correct String length, but then my other Values do not match this value.
can i somehow change it to this:
function PDFTomm(APixels: TPDFFloat): Single;
begin
Result := (APixels * cInchToMM) / Screen.PixelsPerInch;
end;
Example:
Code:
Pos1.Y:= Pos1.Y - fDSpace;
Tx:= 'TESTING';
P.WriteText(Pos1.X, Pos1.Y, Tx);
//DPI 72
Pos1.Y:= Pos1.Y - fDSpace;
Tx:= 'TESTING';
P.WriteText(Pos1.X +PDFTomm(lFC.TextWidth(Tx, fFontSize)), Pos1.Y, Tx);
//DPI 96
Pos1.Y:= Pos1.Y - fDSpace;
Tx:= 'TESTING';
P.WriteText(Pos1.X +(lFC.TextWidth(Tx, fFontSize)) * (25.4 / Screen.PixelsPerInch), Pos1.Y, Tx);
attached is what i draw whit this Code. I Added the same text 2 more times but the starting x Value adds up with the calculated Length of the String. i get the correct length with 96 dpi (Screen.PixelperInch) but not the righ length with PDFToMM (Procedure from Unit "fpGUI", with constant 72 DPI).
Edit: noticed that my pdf "Paper" is smaller than others, but i was using: