I'm developing an in-house report viewing program in C# with Windows Forms, primarily using the CrystalReportViewer.
My development setup is Visual Studio 2012 Professional with Crystal Reports 13.0.7.
Reports are created by management personnel, then uploaded to a server. All office employees can then open the reports in our program.
One report is created with a custom paper size - 10" x 13" envelope.
Unfortunately, when opened in the Viewer, the report is somehow modified to be on letter - 8.5" x 11" paper. The envelope as a paper size is definitely installed on the computer opening the report. This isn't actually a problem for viewing the report.
However, I would like to print the report (to the default printer and on the envelopes) with only one button press - that is, without a print dialog. I have a form with a "Print" button, which takes parameter values before the Viewer form opens. For now, I have to open the Windows print dialog and get the user to select the custom envelope in order to print correctly.
I have attempted to print programmatically using both ReportDocument.PrintToPrinter (CrystalDecisions.Engine) and PrintOutputController.PrintReport (RAS).
PrintToPrinter either tells me that I have an invalid combination of arguments (Scaling and DissociatePageAndPrinterSize), or else the code executes properly just as the printer complains that it does not have letter-size paper in the manual feed (where the 10" x 13" envelopes are).
PrintOutputController seems to work at first, but then the report prints on letter-size paper.
In both cases, I can tell that the envelope as a paper size is being copied from the printer's size enumeration.
Is it possible to print with a custom paper size without a print dialog? If so, how do I accomplish this?
Could the first issue causing the second?
EDIT:
I had asked a similar question in the past, and received an answer. Unfortunately, the solution initially seemed to work, but after lots of testing I have come to the state described above.