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

Error when no printer is installed

edited March 2008 in General
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

Comments

  • edited March 2008
    Hi Stef,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2008
    Nico Cizik (Digital Metaphors) wrote:

    Can you show me were and how I can do this?
  • edited March 2008
    Hi Stef,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2008
    Thank you very much. I'll give it a try.

    --
  • edited March 2008
    Hi Nico,

    Is it required to create my own print dialog for each report in my
    application, or can one handle all reports?

    Regards,
    Stef
  • edited March 2008
    I got it working 'already'.
    One custom dialog will cover for all reports.

    Nico, thank you very much for your help.

    Regards,
    Stef
This discussion has been closed.