Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

How do I know if the report is printed

edited August 2007 in General
Hi,

Maybe a simple or stupid question.

If I do the following:
ppReport.DeviceType:='Screen'
ppReport.print;
Then the user gets a the report on the screen with the ability to print the
document on a printer. But how do I know if the user really prints the
report.

Thanks
Andre

Comments

  • edited August 2007
    Hi Andre,

    ------------------------------------------
    Tech Tip: Detecting whether Report was
    Printed to the Printer
    ------------------------------------------

    The Report.AfterPrint event can be used to
    determine whether the report was printed
    to the printer (rather than preview, ...).


    Example:


    procedure TForm1.ppReport1AfterPrint(Sender: TObject);
    begin

    if (ppReport1.PrinterDevice <> nil) then
    ShowMessage('Report was printed to the printer');

    end;



    Note: If the user cancels the report while it
    is running, then the Report.OnCancel event will
    fire, followed by the Report.AfterPrint event.

    Example:

    procedure TForm1.ppReport1Cancel(Sender: TObject);
    begin
    ShowMessage('Printing cancelled by user');

    end;


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2007
    do we have a way of knowing the status of the print job in the spooler?
    Like cancelled from the windows printer spooler or sent to the printer?
    I can guess this will involve interacting directly with the windows
    spooling system.

    Any ideas?

  • edited August 2007
    Hi Bora,

    Yes, you will need to access the Windows API to get information such as the
    status of the print job after the report has been sent to the printer. Take
    a look at the API help in Delphi for more information.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2007
    thanks Nico,

    it was again easier then expected.

    Andre


This discussion has been closed.