private void btnPrintPreview_Click(object sender, RoutedEventArgs e) { PrintPreviewWindow previewWnd = new PrintPreviewWindow("OrderDocument.xaml", GlobalData.m_orderExample, new OrderDocumentRenderer()); previewWnd.Owner = this; previewWnd.ShowInTaskbar = false; previewWnd.ShowDialog(); }
private void btnPrintDirect_Click(object sender, RoutedEventArgs e) { btnPrintDirect.IsEnabled = false; PrintDialog pdlg = new PrintDialog(); FlowDocument doc = PrintPreviewWindow.LoadDocumentAndRender("OrderDocument.xaml", GlobalData.m_orderExample, new OrderDocumentRenderer()); Dispatcher.BeginInvoke(new DoPrintMethod(DoPrint), DispatcherPriority.ApplicationIdle, pdlg, ((IDocumentPaginatorSource)doc).DocumentPaginator); m_timerToEnableButton = new Timer(TestTimerCallback, null, 3000, Timeout.Infinite); }
private void btnPrintDlg_Click(object sender, RoutedEventArgs e) { PrintDialog pdlg = new PrintDialog(); if (pdlg.ShowDialog() == true) { FlowDocument doc = PrintPreviewWindow.LoadDocumentAndRender("OrderDocument.xaml", GlobalData.m_orderExample, new OrderDocumentRenderer()); Dispatcher.BeginInvoke(new DoPrintMethod(DoPrint), DispatcherPriority.ApplicationIdle, pdlg, ((IDocumentPaginatorSource)doc).DocumentPaginator); } }