Skip to Content

Intermittent "Invalid printer specified" error from PrintToPrinter

I am intermittently getting an error stating "Invalid printer specified" when calling the PrintToPrinter function.

at CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass.ModifyPrinterName(String
at CrystalDecisions.CrystalReports.Engine.PrintOptions.set_PrinterName(String
at NFGCrystalRun.NFGCrystalRun.NFGCrystalRun.NFG_runReport()

The error seems to occur more frequently when there are multiple instances of the process being run at the same time, but from what I understand, Crystal supports up to 75 instances at a time.

I see some posts regarding similar issues but no specific resolutions.

I am using the Crystal runtime for Visual Studio, 64-bit, version 13.0.24.

Windows Server 2016

Visual Studio 2012

The issue occurs on multiple printers, but the main one that we use is a Toshiba E-studio5560C.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Feb 04, 2019 at 10:09 PM

    You are using RAS and then the Engine to set and print, don't mix them.

    See this printer test app:

    Then download this printer test app, use a report with saved data:

    Printing Crystal Reports in .NET


    Add a comment
    10|10000 characters needed characters exceeded

    • Don,

      Thank you for your response. I know that the stack trace references both RAS and the Engine, but that is not actually what is being done in the code. Our code is:

      crReportDocument.PrintOptions.Printername = printerPath
      crReportDocument.PrintToPrinter(1, False, 0, 0)

      That said, I think that I can modify it to use the RAS based on what I see in your test app. Do you agree?

      Dim popt As CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions = New CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions
      popt.PrinterName = printerPath

      - Dan

  • Posted on Feb 06, 2019 at 03:51 PM

    Yes, use POC, it's much better at printing.

    And for more report details have a look at this one as well:


    As for the error, do you know it's CR causing the problem or the printer driver?

    DLL's typically can't pass errors very well and it's usually the last dll the reports the error, in this case CR is simply passing that error to you from somewhere.

    Search MSDN, there are samples on how to query the Print Spooler to get more details from the printer and what that error may be caused by.

    I suspect it's the printer possibly running out of memory and going into a non-functioning state or too many threads going to it or... could be lots of things.

    By using PrintOutputController it's uses CR's printer dialog box and not the Framework's print routines, which are very generic in it's abilities.

    You can change the default in the Viewers Print button to use the POC, see sample on how to.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.