Identifying is a report actually printed
Sorry if I am on old ground, but have tried some of the previous tips to no
avail...
Most of our printed output is achieved by utilising one unit that is passed
a TppReport object. This unit gives the user the option to preview before
printing, picks up the number of copies from the database, loades the data
to be passed to TppReport, checks the data pipeline is not empty, loads the
report template etc. etc.
The final lines that invoke 'printing' are:
if FPreview then
ShowReportViewer(AppReport)
else
AppReport.Print;
After the above, I need to check to see if anything was actually printed so
I can update notes and disable further editing of the data.
I have tried
if AppReport.PrinterDevice <> nil
to determine if printed but this does not give me the correct answer if the
user has previewed the report then printed it from the viewer.
How can I ascertain if the report has been printed, even if via the print
button on the viewer, but ONLY when not Canceled ?
The reason I need this accurate is because of security - the prints in
question are licences issued by local government!
Thanks in advance for you help!!
avail...
Most of our printed output is achieved by utilising one unit that is passed
a TppReport object. This unit gives the user the option to preview before
printing, picks up the number of copies from the database, loades the data
to be passed to TppReport, checks the data pipeline is not empty, loads the
report template etc. etc.
The final lines that invoke 'printing' are:
if FPreview then
ShowReportViewer(AppReport)
else
AppReport.Print;
After the above, I need to check to see if anything was actually printed so
I can update notes and disable further editing of the data.
I have tried
if AppReport.PrinterDevice <> nil
to determine if printed but this does not give me the correct answer if the
user has previewed the report then printed it from the viewer.
How can I ascertain if the report has been printed, even if via the print
button on the viewer, but ONLY when not Canceled ?
The reason I need this accurate is because of security - the prints in
question are licences issued by local government!
Thanks in advance for you help!!
This discussion has been closed.
Comments
have simply pressed the cancel button. In this case you can use the
OnCancelDialogClose event to check the modal status of the dialog. Next, the
report itself could have not completed printing because of problems with the
report itself, though this should generally be visible to the user as an
error dialog should be displayed. The third possibility is that the job
could have failed at the printer. In this case you need to look into how and
if you can query your specific printer driver for the status of the last
print job. Win32 as well as documentation for your specific driver API would
be the best reference here.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Leaving aside the possible reasons a report may have been started but not
finished, my biggest problem at present is identifying whether or not they
even tried to print the report....
As per the Tech Tip, I have tried checking whether or not
ppReport1.PrinterDevice is set.
If the users chooses to PRINT the report, PrinterDevices is set as expected.
If the user chooses to PREVIEW the report, THEN PRINTS IT FROM WITHIN THE
PREVIEWER,
PrinterDevices is NOT set.
Here lies my problem!!
I take on board your suggestions but they are to no avail if I cannot first
determine whether or not anything has been sent to the printer ...
Bearing in mind the number of similar posts, may I suggest an enhacement -
something like a property CompletedSuccessfully (or event?) to which you can
state which output device you are interested in (maybe printer, maybe file
or archive report) and it have a Boolean STATUS than is TRUE if completed
sucessfully (regardless of whether via previewer or not).
In the meantime, any other suggestions as to how I can identify if a report
has been printed?
Regards,
Pete Colson
"Alexander Kramnik (Digital Metaphors)" wrote
In this case simply use the OnPrintingComplete event and check DeviceType at
this point. (You could also implement the OnPrintDialogCreate and
OnPrintDialogClose event to intervene earlier). If it is Screen then the
printing was to the screen. If Printer then the report was printed.
The problem with implementing a property such as CompletedSuccessfully goes
back to the same issues described during my last post. If by
CompletedSuccessfully you mean that the report was generated successfully
then no property is needed. You simply see if your attempt to print the
report raises any exceptions. However, just because the report was generated
and sent to the printer device successfully, doesn't mean that it was
physically printed successfully.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Sorry for any misunderstandings with earlier post ...
"Alexander Kramnik (Digital Metaphors)" wrote