I have read many articles and I spent many hours regarding this issue: how to print in a custom paper size using Crystal Reports in C#? I came across this issue because I need to print in a statement (8.5"x5.5") paper size and some printer's driver have no defined paper of this size, for example Lexmark Pro700 Series. So my options are:
1. Create a new form in Windows (using Print server properties in Control Panel\Hardware and Sound\Devices and Printers) and selecting it in source code (setting System.Drawing.Printing.PrinterSettings.PaperSize.RawKind property). We need to find out the paper ID generated by Windows, this is done by iterating through System.Drawing.Printing.PrinterSettings.PaperSizeCollection and then assign it to RawKind.
2. Setting dimensions in Windows with Printing Preferences for the printer driver and set RawKind = 256 (this is the value for Custom size in the PaperSizeCollection).
3. Set paper size dimensions (width and height) in source code using new System.Drawing.Printing.PaperSize("MYNEWSIZE", 850, 550) or ReportClientDocument.PrintOutputController.ModifyUserPaperSize(550, 850).
There is a problem with options 1 and 2: if the printer is shared on network then the paper size is not accessible by source code (iterating through System.Drawing.Printing.PrinterSettings.PaperSizeCollection), it doesn't matter if you define the paper size locally. This happens only with some printers like Lexmark but not with Epson. The option 3 just didn't work.
I design my reports with Crystal Reports Developer XI Release 2 edition. The form MyReport.rpt (just a test form) was created using Statement, Landscape paper size with a Epson LQ-630 default printer (be sure your default printer has a statement size). See the attached file for some of the code I have tried. So I have a simply question: How to print a form in statement paper size regardless of the sizes defined in the printer driver?