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

printing from preview

edited June 2004 in General
is there a way to tell if the user printed the report while in preview?
on our form there is a print and preview button. if the user selects
print then we set a flag; however it would be nice to do this from
preview if the user printed as well.

thanks
-martha

Comments

  • edited June 2004
    Hi Martha,

    When a user loads a report, you could set a flag of some sort letting you
    know that they have in fact entered the preview window. Then using the
    method below, you can detect if they printed to the printer or not. If they
    print to the printer and the flag is set to true, you would then know that
    they had printed from the preview.

    ------------------------------------------
    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;


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.