0

所以我有下面的代码,当对话框打开时,它显示打印机设置已更改为双面打印,但是当我单击确定并打印时,它不会打印双面,但是当我手动选择双面时,它确实打印正确。任何想法可能是什么情况?在此先感谢您的帮助。ASP.NET 网络应用程序

            using (PrintDialog pd = new PrintDialog())
            {

                PrinterSettings ps = new PrinterSettings();
                ps.Duplex = Duplex.Horizontal;
                pd.PrinterSettings = ps;
               // pd.UseEXDialog = true;



                if (pd.ShowDialog() == DialogResult.OK)
                {
                    ProcessStartInfo info = new ProcessStartInfo(filePath);
                    info.Verb = "Print";
                    info.CreateNoWindow = true;
                    info.WindowStyle = ProcessWindowStyle.Hidden;
                    Process.Start(info);
                }





            }
4

1 回答 1

0

您可以执行此检查PrinterSettings.CanDuplex属性。刚设置

PrinterSettings settings = new PrinterSettings();

并检查您的打印机是否支持它。

  • 此属性获取一个值,该值指示打印机是否支持双面打印。
  • true如果打印机支持双面打印,则返回;否则,false

你可以简单地这样做:

        PrintDialog pd = new PrintDialog();
        PrintDocument MyPrintDocument = new PrintDocument();
        MyPrintDocument.PrintPage += new PrintPageEventHandler(PrintPageEvent);
        pd.PrinterSettings.PrintRange = PrintRange.AllPages;
        MyPrintDocument.PrinterSettings.PrintRange = PrintRange.AllPages;
        MyPrintDocument.Print();

事件在哪里PrintPageEvent触发Print()

于 2013-06-21T12:36:17.263 回答