program CanvasDraw;

{$APPTYPE CONSOLE}

uses

SysUtils, Graphics, Classes, HPDFDoc;

 

var

  I, Y: Integer;

  HPDF: THotPDF;

 

begin

   HPDF:= THotPDF.Create(nil);

   try

         Randomize;

         HPDF.AutoLaunch := true;                               // PDF file will shown automatically

         HPDF.FileName := 'Canvas Drawing.pdf';        

         HPDF.BeginDoc;                                             // Create PDF file

         HPDF.Canvas.Font.Size := 15;                         // Set canvas font size

         I :=20;

         Y := 40;

         HPDF.Canvas.TextOut(10, 10, 'Canvas Ellipses');        //  Print text

         while I <= 520 do                                                   //  Draw colour

        begin                                                                    //    ellipses

               HPDF.Canvas.Brush.Color := random($FFFFFF)   //

               HPDF.Canvas.Ellipse(I, Y, I+90, Y + 160);

               Inc(I, 30);

               Inc( Y, 3 );

         end;

         HPDF.EndDoc;                                                // Close PDF file

   finally

         HPDF.Free;

   end;

end.