[fpc-pascal] New to FPC: Printer problems
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Tue Jun 9 12:37:42 CEST 2009
First include the package Printers4Lazarus as a requirement.
Then you can write something like this:
program printtest;
{$mode objfpc}{$H+}
uses
Interfaces, // this includes the LCL widgetset
Classes,
Forms,
Printer4Lazarus,
Printers,
PrintersDlgs;
var
PaperWorkRect: TRect;
PrintDlg: TPrintDialog;
begin
Application.Initialize;
PrintDlg := TPrintDialog.Create(nil);
try
PrintDlg.MinPage := 1;
PrintDlg.MaxPage := 1;
if PrintDlg.Execute then
begin
PaperWorkRect := Printer.PaperSize.PaperRect.WorkRect;
Printer.BeginDoc;
Printer.Canvas.TextOut(PaperWorkRect.Left, PaperWorkRect.Top, 'TextOut');
Printer.EndDoc;
end;
finally
PrintDlg.Free;
end;
end.
--
Felipe Monteiro de Carvalho
More information about the fpc-pascal
mailing list