cancel
Showing results for 
Search instead for 
Did you mean: 

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

patrick_simons2
Participant
0 Kudos

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

View Entire Topic
patrick_simons2
Participant
0 Kudos

Hi Don,

It's too bad that you can't reproduce my problem. Did you install the printer with the same driver version?

I also do not use the "set printer" button. So your error could nevertheless point to my error? Something for R&D?

Concerning the "no printer" story: yes I'm aware about that. We both discussed this already for years ago:
Printing out of Viewer suggests wrong printer
you wrote here in 2018 "Years ago most Rep's suggested using no printer option. Updates in CR 2008+ now we recommend not using No Printer, I've never suggested that except in special cases."

If you look under
SAP Help Portal: Select the No Printer Option Under Print Setup
"The No Printer Option: Typically, when a Crystal report is created, a default printer has been designated on the development machine. This default printer determines the layout of the images, fonts, and database fields on the report. The advantage to designating a default printer is that it offers consistency in the display of reports: reports are displayed to the layout of the default printer. The disadvantage to using a default printer is that it can present a scalability problem.
Therefore, as a best practice for scalability, modify your report to use no printer driver."

We have ERP programs with over 1000 generic reports, so we can't left no printer unchecked - we never now the printers on customer side.

Concerning your code sample with "CloneHasPrinterInfo.rpt": where does this report come from? How do I understand this? I can't deploy 1000 cloned reports? How would this work with generic reports?

I would however ask you to forward my sample to R&D to emphasize the need of better messages... You have to understand that when our customers get such messages, it's really a misery to find out a solution...

Thanks,

Patrick