Skip to Content
0
Jul 12, 2023 at 12:27 PM

Paper size & "Unable to start the print job. ... security context."

226 Views

Hi,

I'm using CR for VS SP34, the local printer is a "HP Color Laserjet Pro M452nw" (with the latest driver).

When printing with POC (_crystalMainReport.ReportClientDocument.PrintOutputController.PrintReport(_pocReportOptions) ) to the HP Printer,
I get "Unable to start the print job. It may not be possible in the current security context."

When printing with P2P (_crystalMainReport.PrintToPrinter(copies, collateCopies, 0, 0) ) to the HP Printer,
I get "The data area passed to a system call is too small."

After some research I found out that _not_ explicitly setting the paper size in _pocReportOptions causes the problem.

The default paper size in the printer driver is A4.
The default paper size in the generic report is A4 (with both "no printer" and "Dissociate Formatting Page Size and Printer Paper Size" checked).

If I don't set the paper size, the value of _pocReportOptions.PaperSize remains on CrystalDecisions.ReportAppServer.ReportDefModel.CrPaperSizeEnum.crPaperSizeDefault.Then on the PrintReport, the error is raised.

As Don explained some time ago, there is some printer info stored inside the report file and as "No Printer" is checked, there are some matching tests internally in CR. Maybe here comes a bug?

I can reproduce this behavior with Don's test solution (RAS2010_Printing).

If I change the no printer flag in the report (uncheck + check - so nothing changed), save the report, then the error has gone away - strange... In any case, it would be appropriate to get a clearer message text...

If I use another printer, it works fine.

Thanks for any explanation.

Patrick