Error when no printer is installed
Hi,
When I print a report from the preview-window on a Windows computer
with no printers installed I get an AV.
exception class : EPrintError
exception message : Screen printer does not support printing.
main thread ($9d0):
00872e8f +0083 BalancedPlus.exe ppPrintr
TppCustomPrinter.GetDC
Is there a way to overcome this AV?
And where should I put the check in? I could add somewhere:
If Printer.Printers.Count = 0 then Abort;
With kind regards,
Stef
When I print a report from the preview-window on a Windows computer
with no printers installed I get an AV.
exception class : EPrintError
exception message : Screen printer does not support printing.
main thread ($9d0):
00872e8f +0083 BalancedPlus.exe ppPrintr
TppCustomPrinter.GetDC
Is there a way to overcome this AV?
And where should I put the check in? I could add somewhere:
If Printer.Printers.Count = 0 then Abort;
With kind regards,
Stef
This discussion has been closed.
Comments
This is a ReportBuilder exception so the report will cancel itself if it is
encountered (no need to "abort"). You could try to catch the exception at
runtime and handle the action to be taken manually if you would like.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Can you show me were and how I can do this?
After further research I found that this will only work if you are printing
directly to the printer. I assume the issue is when your users click the
print button from the previewer. In this case the exception is raised in
the OK button click of the print dialog. The only work around to handle
this error yourself is to create your own print dialog. This would be a
matter of simply copying the current dialog code, renaming it and
registering it with ReportBuilder. Then inside the btnOkClick event near
the bottom you will see the condition:
if not PrintToFile and not PrintToArchive and (FPrinter.DC = 0) then
The FPrinter.DC = 0 call raises the exception so if you place a Try...Except
around this statement, you should be able to handle it yourself.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
--
Is it required to create my own print dialog for each report in my
application, or can one handle all reports?
Regards,
Stef
One custom dialog will cover for all reports.
Nico, thank you very much for your help.
Regards,
Stef