New Blog Post: PDF/A and Metadata

Detecting whether report printed to printer

edited February 2010 in General
Hello,

my Reports are shown in the Preview-Form.
The User can close the Form or he select PDF-Export from the Printer-Dialog
or want's to print to the Printer.
How can i check, if the Report was printed to the Printer?

I followed the Wiki-Example:

procedure TForm1.ppReport1AfterPrint(Sender:TObject);
begin
if (ppReport1.PrinterDevice<>nil) then DoSomething
end;

but with PDF-Export the PrinterDevice is <>nil, too.

How to find out printed to Printer?

Jürgen

Comments

  • edited February 2010
    Hi Jürgen,

    When printing a report from the print dialog, the printer device will always
    be created. You can also check (TppReport.FileDevice <> nil) to determine
    if the report was then exported to a file.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2010
    Hi Nico,

    Perfect.

    if (Report1.PrinterDevice<>nil) and (Report1.FileDevice=nil) then
    DoSomething

    is the trick that works for me.

    Thank you very much
    Jürgen

This discussion has been closed.