0
我有这个演示应用程序,我需要打印FlowDocument而不会弹出操作系统中的打印对话。你有什么想法如何做到这一点?或者你知道其他可能的解决方案?如何在不显示打印对话的情况下打印?
private void Button_Click(object sender, RoutedEventArgs e)
{
PrintDialog pd = new PrintDialog();
pd.ShowDialog();
if (pd.ShowDialog() != true) return;
flowDocument.PageHeight = pd.PrintableAreaHeight;
flowDocument.PageWidth = pd.PrintableAreaWidth;
IDocumentPaginatorSource idocument = flowDocument as IDocumentPaginatorSource;
pd.PrintDocument(idocument.DocumentPaginator, "Printing Flow Document...");
}
感谢,但.....移除该行代码没有帮助,打印对话框仍然出现 – GibboK
同时删除之前的一个:'pd.ShowDialog ();' – gnarlybracket
我编辑了答案。 – dovid