1
如何批量打印繁殖flowdocumets? 以下代碼應打印不同的文檔,但打印相同。只有打印到xps打印機時,此示例才能正常工作。創建printbatch以打印繁殖flowdocuments
var printDialog = new PrintDialog();
if(printDialog.ShowDialog() == true) {
var xpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(printDialog.PrintQueue);
foreach(var person in persons) {
var doc = Application.LoadComponent(new Uri("Template.xaml", UriKind.Relative)) as FlowDocument;
doc.DataContext = persons;
var paginator = ((IDocumentPaginatorSource)doc).DocumentPaginator;
xpsDocumentWriter.Write(paginator);
}
}