静默打印参考这个实例:https://gcdn.grapecity.com.cn/fo ... &extra=page%3D1
打印代码
- string file_name = @"..\..\PageReport1.rdlx";
- GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(file_name));
- GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport);
- pageDocument.Print(true, true, false);
复制代码 静默的话就修改下 pageDocument.Print(true,true,false)三个里面的true或者false
导出PDF的代码:
- // Provide the page report you want to render.
- System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
- GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);
- // Create an output directory.
- System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyPDF");
- outputDirectory.Create();
- // Provide settings for your rendering output.
- GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
- // Reduce the report size and report generation time.
- pdfSetting.OptimizeStatic = true;
- // Set the rendering extension and render the report.
- GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
- GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
- // Overwrite output file if it already exists
- outputProvider.OverwriteOutputFile = true;
- pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);
复制代码
|