Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将PDF添加到图像报告查看器_C#_Pdf_Reportviewer - Fatal编程技术网

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

C# 将PDF添加到图像报告查看器,c#,pdf,reportviewer,C#,Pdf,Reportviewer,我正在尝试打印一份带有条款和条件PDF的RDL报告。问题是报告本身是一个图像队列,而T&C是PDF格式的。因此,每当我进行“排队”时,向流中添加数据时,它都会像查看一张大图一样查看PDF,而不是查看两页。这会导致GDI+泛型错误。我是否需要将PDF转换成正确的图像格式,以便合并这些文档?以下是我目前掌握的代码: internal static void DoPrintInvoice(int orderID, SalesOrderBLL.DocumentType doctype, string p

我正在尝试打印一份带有条款和条件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)
                        );
            }
        }
    }
内部静态无效DoPrintInvoice(int orderID、SalesOrderBLL.DocumentType doctype、字符串打印机、int副本、列表行)
{
使用(var context=rempscoDataContext.CreateReadOnlyContext())
使用(MiniProfiler.Current.Step(“DoPrintInvoice()”))
{
//客户选择退出
//生成报告
使用(var报告=GetSalesOrderReport(orderID,_DocumentTypeDescriptions[doctype],doctype!=DocumentType.InvoiceLetterhead,行))
{
//返回流的队列。
var streams=printingbl.RenderStreams(报告,横向:false);
//返回字节数组
var TermsAndConditions=GetTermsAndConditions();
//将字节数组转换为内存流。
var TCStream=新的内存流(TermsAndConditions);
//有条件将T&C添加到流中。
if(doctype==DocumentType.orderAcknowledge)
{
streams.Enqueue(TCStream);
}
并行调用(
()=>SaveSalesOrderPDF(订单ID、文档类型、报告),
()=>PrintingBLL.PrintStreams(streams,string.Format(“销售订单({0})”,report.DisplayName),打印机,副本,false)
);
}
}
}

我曾尝试将术语和条件转换为一个映像,然后再转换回一个字节数组,但它给了我相同的GDI通用问题。任何帮助都将不胜感激

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

www.pdfsharp.com