[Lazarus] Printer margins

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Mon Jun 9 21:47:51 CEST 2008


Hello,

Reminder.

Who is responsible for the printer subsystem?

thanks,

Felipe

On Tue, Jun 3, 2008 at 9:54 PM, Felipe Monteiro de Carvalho
<felipemonteiro.carvalho at gmail.com> wrote:
> Ok, thanks, that works nicely, but you have to guess the paper being used.
>
> If we are using a TPrintDialog then the user should be able to select
> the target paper and margins in the TPrintDialog.
>
> So maybe some way to get the paper name is missing from TPrintDialog,
> or even better, get all margins form there.
>
> Here is my current code:
>
> procedure TfrmPrint.btnPrintClick(Sender: TObject);
> var
>  PaperWorkRect: TRect;
>  PrintDlg: TPrintDialog;
> begin
>  PrintDlg := TPrintDialog.Create(Self);
>  try
>    if PrintDlg.Execute then
>    begin
>      Printer.BeginDoc;
>      Printer.papersize.papername := 'A4';
>      PaperWorkRect := Printer.PaperSize.PaperRect.WorkRect;
>      Printer.Canvas.TextOut(PaperWorkRect.Left, PaperWorkRect.Top, 'TextOut');
>      Printer.EndDoc;
>    end;
>  finally
>    PrintDlg.Free;
>  end;
> end;
>
> thanks,
> --
> Felipe Monteiro de Carvalho
>



-- 
Felipe Monteiro de Carvalho



More information about the Lazarus mailing list