我想知道如何在WPF中打印Flow Document而不显示打印对话框。
谢谢帮助...
谢谢帮助...
您可以在不显示对话框的情况下(即不调用ShowModal)使用PrintDialog类。
以下是一种更改默认打印机或更改其他设置的方法:
using System.Printing; //add reference to System.Printing Assembly
//if you want to modify PrintTicket, also add
//reference to ReachFramework.dll (part of .net install)
...
var dlg = new PrintDialog();
dlg.PrintQueue = printer; // this will be your printer. any of these: new PrintServer().GetPrintQueues()
dlg.PrintTicket.CopyCount = 3; // number of copies
dlg.PrintTicket.PageOrientation = PageOrientation.Landscape;
dlg.PrintVisual(canvas);
尝试
PrintDialog dialog = new PrintDialog();
dialog.PrintVisual(_PrintCanvas, "My Canvas");