c# – 使用PDFSharp将多个.rdlc报告呈现为单个PDF
发布时间:2020-12-15 17:24:43 所属栏目:百科 来源:网络整理
导读:我正在运行多个报告并将它们合并为一个PDF文件.对于每个报告,我将数据源,参数和报告路径传递给以下内容.结果是具有正确页数的PDF文件,但所有页面都是空白的.我错过了什么? LocalReport report = null;PdfDocument pdfDoc = new PdfDocument();private void
我正在运行多个报告并将它们合并为一个PDF文件.对于每个报告,我将数据源,参数和报告路径传递给以下内容.结果是具有正确页数的PDF文件,但所有页面都是空白的.我错过了什么?
LocalReport report = null; PdfDocument pdfDoc = new PdfDocument(); private void ProcessReport( ReportDataSource reportDS,ReportParameter[] reportParms,string reportPath) { string format = "PDF"; string deviceInfo = null; string encoding = String.Empty; string mimeType = String.Empty; string extension = String.Empty; Warning[] warnings = null; string[] streamIDs = null; report = new LocalReport(); report.EnableExternalImages = true; report.ReportPath = reportPath; if (reportParms != null) report.SetParameters(reportParms); if (reportDS != null) report.DataSources.Add(reportDS); Byte[] pdfArray = report.Render( format,deviceInfo,out mimeType,out encoding,out extension,out streamIDs,out warnings); //Stream s = new MemoryStream(pdfArray); MemoryStream ms = new MemoryStream(pdfArray); PdfDocument tempPDFDoc = PdfReader.Open(ms,PdfDocumentOpenMode.Import); for (int i = 0; i < tempPDFDoc.PageCount; i++) { PdfPage page = tempPDFDoc.Pages[i]; pdfDoc.AddPage(page); } } 解决方法
请尝试使用此主题中描述的不同设置生成报告:
http://forum.pdfsharp.net/viewtopic.php?p=1613#p1613 如果您向我们提供了一些不起作用的文件,我们可以尝试在PDFsharp中修复此问题. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |