双面打印机C#

2020-08-23 10:52发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,

我正在尝试在正面/背面打印,但出现了单独的页面。
我在做什么错? 我正在将Sap Engine用于.NetFramework 13.0.22.2668

谢谢

这是代码:

 private void cmdPrint_Click(对象发送者,EventArgs e)
         {
             尝试
             {
                 PrintDialog拨号= new PrintDialog();
                 PrintDocument doc = new PrintDocument();

                 Dial.Document = doc;
                 Dial.ShowNetwork = true;
                 dial.PrinterSettings.Copies = 1;
                 Dial.PrinterSettings.PrinterName = GetPrinterName();//获取默认打印机
                 Dial.AllowSomePages = true;
                 Dial.AllowSelection = false;
                 Dial.AllowCurrentPage = false;

                //表单上的复选框以选择双工
                 如果(checkDuplex.Checked)
                     Dial.PrinterSettings.Duplex = Duplex.Vertical; //打印双面
               
                 DialogResult结果= dial.ShowDialog();
     
                 如果(结果== DialogResult.OK)
                     PrintReport(doc);
             }
             抓住(前例外)
             {
             }
         }

         私有void PrintReport(PrintDocument文档)
         {
             ReportDocument rDoc =(ReportDocument)crystalReportViewer1.ReportSource;

            //修复错误以切换另一个默认打印机
             字符串prinName = document.PrinterSettings.PrinterName;
             CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument _rcd1 =默认值(CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument);
             _rcd1 = rDoc.ReportClientDocument;
             _rcd1.PrintOutputController.GetPrintOptions()。PrinterName = prinName;

             如果(!string.IsNullOrEmpty(rDoc.PrintOptions.PrinterName))
             {
             }
            //结束修复

             rDoc.PrintOptions.PrinterName = prinName;
             rDoc.PrintToPrinter(document.PrinterSettings.Copies,false,document.PrinterSettings.FromPage,document.PrinterSettings.ToPage);
         } 

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,

我正在尝试在正面/背面打印,但出现了单独的页面。
我在做什么错? 我正在将Sap Engine用于.NetFramework 13.0.22.2668

谢谢

这是代码:

 private void cmdPrint_Click(对象发送者,EventArgs e)
         {
             尝试
             {
                 PrintDialog拨号= new PrintDialog();
                 PrintDocument doc = new PrintDocument();

                 Dial.Document = doc;
                 Dial.ShowNetwork = true;
                 dial.PrinterSettings.Copies = 1;
                 Dial.PrinterSettings.PrinterName = GetPrinterName();//获取默认打印机
                 Dial.AllowSomePages = true;
                 Dial.AllowSelection = false;
                 Dial.AllowCurrentPage = false;

                //表单上的复选框以选择双工
                 如果(checkDuplex.Checked)
                     Dial.PrinterSettings.Duplex = Duplex.Vertical; //打印双面
               
                 DialogResult结果= dial.ShowDialog();
     
                 如果(结果== DialogResult.OK)
                     PrintReport(doc);
             }
             抓住(前例外)
             {
             }
         }

         私有void PrintReport(PrintDocument文档)
         {
             ReportDocument rDoc =(ReportDocument)crystalReportViewer1.ReportSource;

            //修复错误以切换另一个默认打印机
             字符串prinName = document.PrinterSettings.PrinterName;
             CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument _rcd1 =默认值(CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument);
             _rcd1 = rDoc.ReportClientDocument;
             _rcd1.PrintOutputController.GetPrintOptions()。PrinterName = prinName;

             如果(!string.IsNullOrEmpty(rDoc.PrintOptions.PrinterName))
             {
             }
            //结束修复

             rDoc.PrintOptions.PrinterName = prinName;
             rDoc.PrintToPrinter(document.PrinterSettings.Copies,false,document.PrinterSettings.FromPage,document.PrinterSettings.ToPage);
         } 
付费偷看设置
发送
1条回答
哎,真难
1楼 · 2020-08-23 11:28.采纳回答

您不能使用P2P更改打印机选项。 您必须使用PrintOutputController();

有关打印机测试应用程序,请参见下载的WIKI:

https: //wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

一周热门 更多>