【问题标题】:Add PDF to Image ReportViewer将 PDF 添加到 Image ReportViewer
【发布时间】:2017-06-23 13:23:02
【问题描述】:

我正在尝试打印带有条款和条件 PDF 的 RDL 报告。问题是报告本身是一个图像队列,而 T&C 是 PDF 格式的。因此,每当我执行“入队”,添加到流中时,它都会像查看一个大图像一样查看 PDF,而不是两页。这会导致 GDI+ 泛型错误。无论如何,我是否可以将 PDF 转换为正确的图像格式,以便我可以合并这些文档?这是我到目前为止的代码:

internal static void DoPrintInvoice(int orderID, SalesOrderBLL.DocumentType doctype, string printer, int copies, List<string> lines)
    {
        using (var context = rempscoDataContext.CreateReadOnlyContext())
        using (MiniProfiler.Current.Step("DoPrintInvoice()"))
        {
            //Customer Opt-Out

            // Generate Report
            using (var report = GetSalesOrderReport(orderID, _DocumentTypeDescriptions[doctype], doctype != DocumentType.InvoiceLetterhead, lines))
            {

                // returns queue of streams.
                var streams = PrintingBLL.RenderStreams(report, landscape: false);
                // returns byte array
                var TermsAndConditions = GetTermsAndConditions();

                //convert byte array to memory stream.
                var TCStream = new MemoryStream(TermsAndConditions);

                //conditional to add T&C's to stream.
                if (doctype == DocumentType.OrderAcknowledgement)
                {
                    streams.Enqueue(TCStream);   
                }

                ParallelInvoke(
                        () => SaveSalesOrderPDF(orderID, doctype, report),
                        () => PrintingBLL.PrintStreams(streams,  string.Format("Sales Order ({0})", report.DisplayName), printer, copies, false)
                        );
            }
        }
    }

我尝试将条款和条件转换为图像,然后转换回字节数组,但它给了我相同的 GDI 通用问题。任何帮助将不胜感激!

【问题讨论】:

    标签: c# pdf reportviewer


    【解决方案1】:

    您看过 PDFSharp 吗?过去我很幸运地使用它来渲染 PDF。

    www.pdfsharp.com

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-06
      • 2018-06-28
      • 1970-01-01
      • 2014-01-06
      • 1970-01-01
      • 2018-06-18
      • 2012-06-07
      • 1970-01-01
      相关资源
      最近更新 更多