我有这个演示应用程序,我需要打印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...");
}
答案 0 :(得分:4)
删除这一行:
pd.ShowDialog();
if (pd.ShowDialog() != true) return;