将 PDF 添加到图像报告查看器



我正在尝试打印带有条款和条件PDF的RDL报告。 问题在于报告本身是一个图像队列,而条款和条件是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 通用问题。 任何帮助将不胜感激!

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

www.pdfsharp.com

最新更新