我只是想知道如何在不在WPF中显示Print Dialog的情况下打印流文档。
感谢您的帮助...
答案 0 :(得分:16)
您可以使用PrintDialog类而不显示对话框(不调用ShowModal)
答案 1 :(得分:15)
这是您可以更改默认打印机或更改其他设置的方法之一:
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);
答案 2 :(得分:3)
尝试
PrintDialog dialog = new PrintDialog();
dialog.PrintVisual(_PrintCanvas, "My Canvas");