TadvPDFLib and right alignment

I'm just trying to use TadvPDFLib to create a PDF on the fly.
I need to write text (numbers) aligned on the right in the row.
Is this possible?
If so, any help about it?

Thank you in advance.

Hi,

You can control alignment with the Alignment property, set it before drawing

AdvPDFLib1.Graphics.Alignment := gtaTrailing;

or alternatively use the TAdvGraphicsPDFEngine class:

uses
  AdvGraphicsPDFEngine, AdvGraphicsTypes, Types;

procedure TForm1.FormCreate(Sender: TObject);
var
  g: TAdvGraphicsPDFEngine;
begin
  AdvPDFLib1.BeginDocument('test.pdf');
  AdvPDFLib1.NewPage;
  g := TAdvGraphicsPDFEngine.Create(AdvPDFLib1);
  try
    g.DrawRectangle(RectF(100, 400, 400, 600));
    g.DrawText(RectF(100, 400, 400, 600), 'Right Aligned Text', False, gtaTrailing);
  finally
    g.Free;
  end;
  AdvPDFLib1.EndDocument(True);
end;

Thank you.
It works very well.

AdvPDFLib1.Graphics.Alignment := gtaLeading; // left alignment
AdvPDFLib1.Graphics.Alignment := gtaCenter; // center alignment
AdvPDFLib1.Graphics.Alignment := gtaTrailing; // right alignment

I think is more preferable using RectF instead of PointF.

g.DrawText(RectF(100, 400, 400, 600), 'Right Aligned Text', False, gtaTrailing);

I have another question.
Is possible to get/set the DPI of the file?
I know that, usually, the PDF have 72 dpi/inch.

PDF files do not have a DPI settings as all graphics are vector/scalable and DPI independant, except for images. The DPI setting for printing is based on the printer settings itself. If you include images and want to make sure the images are higher, you need to change the image resolution. You can also change PDF page sizes with the AdvPDFLib1.PageSize property or customize it with AdvPDFLib1.PageWidth & AdvPDFLib1.PageHeight, but even then the graphics will not scale according to the size of the page.