DynaPDF Manual - Page 336

Previous Page 335   Index   Next Page 337

Function Reference
Page 336 of 839
procedure TForm1.Button1Click(Sender: TObject);
var pdf: TPDF;
begin
pdf := nil;
try
pdf := TPDF.Create;
pdf.SetOnErrorProc(nil, @ErrProc);
pdf.CreateNewPDF('c:\dout.pdf');
pdf.SetDocInfo(diCreator, 'Delphi sample project');
pdf.SetDocInfo(diSubject, 'Simple shapes');
pdf.SetDocInfo(diTitle, 'Vector graphics');
pdf.Append;
pdf.SetPageCoords(pcTopDown);
pdf.SetFont('Arial', fsNone, 12, true, cp1252);
// default draw direction counter clockwise
pdf.SetColors(clRed);
pdf.WriteText(380, 143, 'DrawArcEx');
pdf.DrawArcEx(360, 150, 200, 100, 330, 30);
pdf.StrokePath;
pdf.SetColors(clBlue);
pdf.WriteText(380, 253, 'DrawPie');
pdf.DrawPie(360, 260, 200, 100, 330, 30, fmStroke);
pdf.SetColors(clGreen);
pdf.WriteText(380, 363, 'DrawChord');
pdf.DrawChord(360, 370, 200, 100, 330, 30, fmStroke);
// new draw direction
pdf.SetDrawDirection(ddClockWise);
pdf.SetColors(clRed);
pdf.WriteText(200, 143, 'DrawArcEx');
pdf.DrawArcEx(250, 150, 200, 100, 330, 30);
pdf.StrokePath;
pdf.SetColors(clBlue);
pdf.WriteText(200, 253, 'DrawPie');
pdf.DrawPie(250, 260, 200, 100, 330, 30, fmStroke);
pdf.SetColors(clGreen);
pdf.WriteText(200, 363, 'DrawChord');
pdf.DrawChord(250, 370, 200, 100, 330, 30, fmStroke);
pdf.EndPage;
pdf.CloseFile;
except
on E: Exception do MessageDlg(E.Message, mtError, [mbOK], 0);
end;
if pdf <> nil then pdf.Free;
end;
 

Previous topic: DrawPie

Next topic: EditPage, EditTemplate