How do I know if the report is printed
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
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
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;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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?
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
it was again easier then expected.
Andre