Uses TSPdfEnumerations; {$IFDEF LINUX} separator := "/"; {$ELSE} separator := "\\"; {$ENDIF} alias := ""; path := ""; InitCmdParams(alias, path); output_file := "grid_sheet_demo.pdf"; output_file := path + separator + output_file; pdf := new PdfFile(); // add a new page object. page := pdf.AddPage(); page.SetHeight(600); page.SetWidth(400); PrintGrid(pdf, page); // save the document to a file err := pdf.SaveToFile(alias, output_file); echo "SaveToFile::\t", "err := ", format("%x", err), "\toutput_file := ", output_file, "\n"; return; Function PrintGrid(pdf, page) Begin height := page.GetHeight(); width := page.GetWidth(); font := pdf.GetFont("Helvetica", ""); page.SetFontAndSize(font, 5); page.SetGrayFill(0.5); page.SetGrayStroke(0.8); // Draw horizontal lines y := 0; while y < height do begin if y % 10 = 0 then page.SetLineWidth(0.5); else begin wid := page.GetWidth(); if wid <> 0.25 then page.SetLineWidth(0.25); end page.MoveTo(0, y); page.LineTo(width, y); page.Stroke(); if y % 10 = 0 and y > 0 then begin page.SetGrayStroke(0.5); page.MoveTo(0, y); page.LineTo(5, y); page.Stroke(); page.SetGrayStroke(0.8); end y += 5; end // Draw vertical lines x := 0; while x < width do begin if x % 10 = 0 then page.SetLineWidth(0.5); else if page.GetWidth() <> 0.25 then page.SetLineWidth(0.25); page.MoveTo(x, 0); page.LineTo(x, height); page.Stroke(); if x % 50 = 0 and x > 0 then begin page.SetGrayStroke(0.5); page.MoveTo(x, 0); page.LineTo(x, 5); page.Stroke(); page.MoveTo(x, height); page.LineTo(x, height - 5); page.Stroke(); page.SetGrayStroke(0.8); end x += 5; end // Draw horizontal text y := 0; while y < height do begin if y % 10 = 0 and y > 0 then begin page.BeginText(); page.MoveTextPos(5, y - 2); page.ShowText(tostring(y)); page.EndText(); end y += 5; end // Draw vertical text x := 0; while x < width do begin if x % 50 = 0 and x > 0 then begin buf := tostring(x); page.BeginText(); page.MoveTextPos(x, 5); page.ShowText(buf); page.EndText(); page.BeginText(); page.MoveTextPos(x, height - 10); page.ShowText(buf); page.EndText(); end x += 5; end page.SetGrayFill(0); page.SetGrayStroke(0); End;