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

Hiow do I tell if printing was successful?

edited November 2005 in General
I have an automated app that prints reports to designated
printers. I want it to run unattended. Is there a way to confirm
printing has been successful?

Comments

  • edited November 2005
    Hi Pat,

    This really depends on what you consider a successful print. As far as
    ReportBuilder is concerned, a successfull print is determined by the Windows
    API calls to the driver are successful. RB however has no knowledge whether
    the report was actually produced (i.e. out of paper perhaps). See the
    following article on how to detect if the report was printed to the printer.
    Idealy you should receive an exception if there is an error in RB when
    printing.

    ------------------------------------------
    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
This discussion has been closed.