SAP Knowledge Base Article - Public

2402814 - Error when canceling a print job using PrintOutputController() to the local file system: Unable to start the print job. It may not be possible in the current security context.

Symptom

We have observed a problem with CR 13 SP18. After previewing a report and then redirecting preview to get printed via printers installed on our system, we received the error below:

Unable to start the print job.  It may not be possible in the current security context.

I googled and found the link below from SAP community but could not deduce much from there. https://archive.sap.com/discussions/thread/3903585 do you have anything concrete for us in this regard or how can it be possibly fixed?

Environment

  • Crystal Reports for Visual Studio
  • Windows XPS printer
  • Any Printer that is setup to out to a File

Reproducing the Issue

  1. Set the standard printer to the "Microsoft XPS Document Writer"
  2. open a report in CR13 viewer
  3. in the viewer click the print icon
  4. cancel the dialog (with cancel button): file saving as (*.xps)

-> Now I received the error below:
"Unable to start the print job.  It may not be possible in the current security context."

Resolution

Our Developers have looked into this issue and discovered this is a problem with the Windows Print dialog box and API's in the back end.

There is no state returned by the Dialog box if the Cancel button is clicked so CR cannot capture the Cancel state and therefore assumes it will be generating the output file.

Due to the Cancel button being clicked though there is no output file name and generates the error.

Note: The error is misleading and is being generated by the OS, CR is simply passing the message along.

Keywords

CR for VS, Printing, cancel printing, Unable to start the print job. It may not be possible in the current security context., XPS, File output , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio