我有一个使用Telerik Reportig创建的报告,希望单击即可直接将报告打印到打印机,但是打印的报告尺寸小于实际的报告设计版面。
这是我的代码,我不知道我错过了什么。
// Obtain the settings of the default printer
System.Drawing.Printing.PrinterSettings printerSettings= new System.Drawing.Printing.PrinterSettings();
IEnumerable<PaperSize> paperSizes = printerSettings.PaperSizes.Cast<PaperSize>();
PaperSize sizeA4 = paperSizes.First<PaperSize>(size => size.Kind == PaperKind.A4); // setting paper size to A4 size
printerSettings.DefaultPageSettings.PaperSize = sizeA4;
// The standard print controller comes with no UI
System.Drawing.Printing.PrintController standardPrintController =new System.Drawing.Printing.StandardPrintController();
// Print the report using the custom print controller
Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
reportProcessor.PrintController = standardPrintController;
Telerik.Reporting.TypeReportSource typeReportSource =
new Telerik.Reporting.TypeReportSource();
// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = "ABC.ReportLibrary.XYZReport, TekMetroDMS.ReportLibrary";
reportProcessor.PrintReport(typeReportSource, printerSettings);