小编Jus*_*res的帖子

打印 c# 时传递给系统调用的数据区域太小

我有一个窗口服务,它使用 PrintDocument 类打印带有图像的某些文档。有时,我在打印“传递给系统调用的数据区域太小”时遇到此错误,并且报告上的图像未打印。我一直在寻找原因。这是代码:

public string Print(List<PrintPageInfo> printList, Printer_Settings printerSettings)
        {
            string result = string.Empty;

            try
            {
                List<PrintPageInfo> sortedPrintList = printList.OrderBy(p => p.SequenceOrder).ThenBy(x => x.SubSequenceOrder).ToList();

                lock (_printLocker)
                {
                    foreach (var item in sortedPrintList)
                    {
                        streams = item.Streams;

                        if (streams == null || streams.Count == 0)
                            throw new Exception("No stream to print.");

                        using (var printDoc = new PrintDocument())
                        {
                            printDoc.PrinterSettings.PrinterName = printerSettings.PrinterName;
                            //if (printDoc.PrinterSettings.IsValid) throw new Exception("Printer name is invalid.");

                            PrintController printController = new StandardPrintController();
                            printDoc.PrintController = printController;

                            printDoc.DefaultPageSettings.Color = true;
                            printDoc.DefaultPageSettings.Landscape …
Run Code Online (Sandbox Code Playgroud)

.net c# printdocument rdlc localreport

5
推荐指数
0
解决办法
1114
查看次数

标签 统计

.net ×1

c# ×1

localreport ×1

printdocument ×1

rdlc ×1