- Calling the PrintToPrinter() method.
- Print a report using the Crystal Reports .NET SDK.
- Pages are missing from the print out, usually where a subreport has spanned multiple pages.
- eg. A 4 page report is reduced to 2 pages. The 1st and 4th page are printed as 1st and 2nd. The original 2nd and 3rd pages are missing.
Development or Application Environment
- Windows OS
- Visual Studio 2005
- Crystal Reports for Visual Studio 2005, version 10.2
Report Designer Environment
- Windows OS
- Crystal Reports 2008 SP3
- The issue has been identified and logged under Problem Report ID ADAPT01490140.
- The issue seems to be related to loading a new report file in an older reporting engine.
- Crystal Reports 2008 supports a new feature called "Dissociate Formatting Page Size and Printer Paper Size".
- This "Dissociate" feature causes problems when the new report is loaded in an older reporting engine - missing pages.
This solution only works with the Crystal Reports 2008 .NET SDK. The 10.2 version of the CR .NET SDK doesn't have the PrintToPrinter() method overload that allows reformatting of the page settings.
- Disable the "Dissociate Formatting Page Size and Printer Paper Size" in the Crystal Reports 2008 designer, by
- Go go File > Page Setup ...
- Uncheck "Dissociate ...", then click OK.
- Use the PrintToPrinter (System.Drawing.Printing.PrinterSettings printerSettings, System.Drawing.Printing.PageSettings pageSettings , bool reformatReportPageSettings) method to print your report.
- Ensure that the reformatReportPageSettings is set to true.
System.Drawing.Printing.PrinterSettings oPrinterSettings = new System.Drawing.Printing.PrinterSettings();
System.Drawing.Printing.PageSettings oPageSettings = new System.Drawing.Printing.PageSettings();
oPrinterSettings.PrinterName = "Microsoft XPS Document Writer"; // Use your own printer name here.
boReportDocument.PrintToPrinter(oPrinterSettings, oPageSettings, true);
KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem