Detect Printed from Preview
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
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
This discussion has been closed.
Comments
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;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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\)"
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
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks! I'll check it out at the office tomorrow...
Cheers,
EdB
In article <3f09cde5$1@dm500.>, "Nico Cizik \(Digital Metaphors\)"