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

Detect Printed from Preview

edited July 2003 in General
I have an app that needs to record whether or not the user actually
printed a report. I tend to always start with "screen" as default - is
there a built-in way to determine:

1) did the user print the report to printer
2) did the user elect to print all, or just a range?

Thanks,
EdB

Comments

  • edited July 2003
    ------------------------------------------
    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
  • edited July 2003

    Thanks, is there any way of determining if all pages were printed (or if
    bonehead user printed a range)? If not, is there a simple way to disable
    range setting short of designing a custom print dialog?

    Cheers,
    EdB


    In article <3f01ef61$1@dm500.>, "Nico Cizik \(Digital Metaphors\)"
  • edited July 2003
    Ed,

    Creating a custom print dialog is very simple and would be your best bet for
    disabling the page range. Detecting if the user selected to print a page
    range would be much more difficult. I created a simple example that you can
    download by following the link below. This should get you on the right
    track.

    http://www.digital-metaphors.com/tips/CustomPrintDlg.zip



    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2003

    Thanks! I'll check it out at the office tomorrow...

    Cheers,
    EdB
    In article <3f09cde5$1@dm500.>, "Nico Cizik \(Digital Metaphors\)"
This discussion has been closed.