TAdvPDFLib can I access the canvas

Hi, with TAdvPDFLib is it possible to directly access the PDF canvas, i.e. a TCanvas object? We want to draw some high resolution images (e.g. 10000x10000 pixels) and get out of memory errors if we have to first draw this to a bitmap. Thx.

Unfortunately there is no TCanvas and right now, the bitmap drawing goes through a TBitmap object. It's not possible to add bitmap data directly from a stream, we would need to add support for that. Which TCanvas capabilities do you need exactly?

Well most of them, we have some fairly complex plotting code. In the PDF we want to see exactly the same thing as we have drawn onto a TImage on a form, but we want it to be higher resolution in the PDF. So we can't just take a screengrab, we need to do all the canvas based drawing again on the PDF.

So we would require at least the following:
Pen
Brush
Font
MoveTo
LineTo
TextOut
Ellipse
Arc
Polygon
Polyline
Rectangle
FillRect

Thx.

If you have the drawing calls to a TCanvas, which you are using to create the bitmap you could map them onto TAdvGraphics. We have created a special descendant engine that you can use together with the PDF engine to create more complex graphics. Here is an example.

uses
  Math, AdvTypes, Types, AdvPDFLib, AdvGraphicsTypes, AdvGraphicsPDFEngine;

procedure TForm12.Button1Click(Sender: TObject);
var
  p: TAdvPDFLib;
  pg: TAdvGraphicsPDFEngine;
  pth: TAdvGraphicsPath;
  r: TRectF;
  st, swp: Single;
  cp, rd, sp, ird: TPointF;
begin
  p := TAdvPDFLib.Create;
  pg := TAdvGraphicsPDFEngine.Create(p);
  pth := TAdvGraphicsPath.Create;
  try
    p.BeginDocument('test.pdf');
    p.NewPage;

    pg.Fill.Color := gcRed;
    pg.Fill.Kind := gfkGradient;
    pg.Fill.ColorTo := gcOrange;
    pg.Stroke.Kind := gskSolid;
    pg.Stroke.Color := gcDarkred;

    r := RectF(200, 200, 500, 500);

    st := 90;
    swp := 180;

    rd := PointF((r.Right - r.Left) / 2, (r.Bottom - r.Top) / 2);
    ird := PointF((r.Right - r.Left) / 4, (r.Bottom - r.Top) / 4);
    cp := CenterPointEx(r);
    sp.X := cp.X + ird.X * Cos(DegToRad(st));
    sp.Y := cp.Y + ird.Y * Sin(DegToRad(st));

    pth.Clear;
    pth.MoveTo(sp);
    pth.AddArc(cp, rd, st, swp);
    pth.AddArc(cp, ird, st + swp, -swp);
    pth.ClosePath;

    pg.DrawPath(pth);

    p.EndDocument(True);
  finally
    pth.Free;
    pg.Free;
    p.Free;
  end;
end;

Ok thx we'll have a look into that.