How to position an image from gauge export in PDF


The gauge image is drawn over existing text. How can I place the image below the text?

  bc := (Sender as TTMSFNCBitmapContainer);

  p := TTMSFNCPDFLib.Create;
  g := TTMSFNCGraphicsPDFEngine.Create(p);
  d := TTMSFNCWidgetGauge.Create(nil);

  p.BitmapContainer := bc;


    s := 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry''s standard dummy'+
      'text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. '+
      'It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It'+
      ' was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with des'+
      'ktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.';

    p.HeaderFont.Name := 'Roboto';
    p.FooterFont.Name := 'Roboto';
    p.PageNumberFont.Name := 'Roboto';

    p.Graphics.DrawImageWithName('MyImage', PointF(10, 10));

    p.Graphics.Font.Name := 'Roboto';
    p.Graphics.Font.Size := 14;
    p.Graphics.Fill.Color := gcNull;
    r := RectF(10, 100, 500, 400);
    p.Graphics.DrawText(s, r, 3);

    if Supports(d, ITMSFNCGraphicsExport, e) then
      e.Export(g, RectF(50, 550, 500, 350));



By reversing the drawing order. You draw the export graphics last, so you should draw the text last instead.

The graphic is on the right place but got mirrored.

Are you referring to DrawImageWithName or the gauge? Please provide some screenshots explaining what is going on.

Sorry I ment the gauge image.

Well, you reversed the rectangle:

RectF(50, 550, 500, 350)

Please use

RectF(50, 350, 500, 550);

The parameters are Left, Top, Right, Bottom

Thank you! I definitely need more coffee :wink: