所以我有下面的代码,当对话框打开时,它显示打印机设置已更改为双面打印但是当我单击确定并打印时,它不会打印双面但是当我手动选择双面时它会打印正确。任何想法可能是什么情况?在此先感谢您的帮助。 ASP.NET WEB应用程序
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);
}
}
答案 0 :(得分: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()
上触发的事件;