Hi
In order to preserve the key information about the font, I created a temporary variable called “Old_Font” to store it and restore it at the end.
VAR
le_Cadre : TRectF;
Haut : Integer;
Old_Font : TAdvPDFGraphicsLibFont;
Old_Align : TAdvGraphicsTextAlign;
begin
Old_Font := TAdvPDFGraphicsLibFont.Create;
Old_Font := Pdf.Graphics.Font;
Old_Align:= Pdf.Graphics.Alignment;
Pdf.Graphics.Font.Name := 'Arial';
Pdf.Graphics.Font.Size := 50;
Pdf.Graphics.Font.Color := gcYellow;// gcSilver;
Pdf.Graphics.Fill.Color := gcNull;
Pdf.Graphics.Alignment := gtaCenter;
le_Cadre := RectF( Marge, MillimeterToPixel(150), pdf.PageWidth, Page_Fin );
Pdf.Graphics.DrawText(
'2026',
le_cadre, 1, 1.0, false );
Pdf.Graphics.Font := Old_Font;
Pdf.Graphics.Alignment := Old_Align;
Old_Font.Free;
end; // Fin de PROCEDURE
It "works". However, when I assigned : Pdf.Graphics.Font.Size := 50, automatically Old_Font .Graphics.Font.Size is assigned the same value i.e 50.
I made a mistake ?