1941490 - Determining proper case for printer names in Windows .NET application

SAP Knowledge Base Article - Public

1941490 - Determining proper case for printer names in Windows .NET application

Symptom

Depending on the Operating System and how Printers are added to the local PC can cause Crystal Reports .NET to throw an Exception when trying to set the printer to use.

Error: System.Runtime.InteropServices.COMException (0x80040205): The printer specified can not be found.  It may not be accessible in the current security context.

Environment

Crystal Reports Developer for Visual Studio

Resolution

Crystal Reports for Visual Studio is case sensitive when using the local Printer Names.

Windows System.Printer info does not care what the case of the printer and network path is.

To make this work when designing reports against specific printers add the printer and declare the printer name in all upper case.

The convert the System.Printer name to all upper case in code and no Exceptions should be found when setting.

CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions.PrinterName member to ReportDocument.ReportClientDocument.PrintOutputController.PrintReport()

 

Keywords

KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio