微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 使用PDFSharp将多个.rdlc报告呈现为单个PDF

我正在运行多个报告并将它们合并为一个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中修复此问题.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐