C# 如何在不显示打印对话框的情况下打印?
我有这个演示应用程序,我需要打印流程文档,而不需要从操作系统弹出打印对话框。你知道怎么做吗?或者你知道其他可能的解决方案C# 如何在不显示打印对话框的情况下打印?,c#,.net,wpf,printing,C#,.net,Wpf,Printing,我有这个演示应用程序,我需要打印流程文档,而不需要从操作系统弹出打印对话框。你知道怎么做吗?或者你知道其他可能的解决方案 private void Button_Click(object sender, RoutedEventArgs e) { PrintDialog pd = new PrintDialog(); pd.ShowDialog(); if (pd.ShowDialog() != true) return; flowDocument.PageHei
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...");
}
删除以下行:
pd.ShowDialog();
if (pd.ShowDialog() != true) return;
删除以下行:
pd.ShowDialog();
if (pd.ShowDialog() != true) return;
谢谢,但是……删除那一行代码没有帮助,打印对话框仍然出现,同时删除之前的一行:
pd.ShowDialog()代码>谢谢,但是…..删除该行代码没有帮助,打印对话框仍然出现,同时删除之前的一行:pd.ShowDialog()代码>