void OnPrintPreview(object sender, ExecutedRoutedEventArgs e) { PrintDialog printDialog = PrintPreviewViewContent.PrintDialog; FlowDocument fd = DocumentPrinter.CreateFlowDocumentForEditor(this); PrintPreviewViewContent.ApplySettingsToFlowDocument(printDialog, fd); PrintPreviewViewContent.ShowDocument(fd, Path.GetFileName(this.FileName)); }
void OnPrintPreview(object sender, ExecutedRoutedEventArgs e) { PrintDialog printDialog = PrintPreviewViewContent.PrintDialog; FlowDocument fd = DocumentPrinter.CreateFlowDocumentForEditor(this); fd.ColumnGap = 0; fd.ColumnWidth = printDialog.PrintableAreaWidth; fd.PageHeight = printDialog.PrintableAreaHeight; fd.PageWidth = printDialog.PrintableAreaWidth; PrintPreviewViewContent.ShowDocument(fd, Path.GetFileName(this.FileName)); }
void OnPrint(object sender, ExecutedRoutedEventArgs e) { PrintDialog printDialog = PrintPreviewViewContent.PrintDialog; if (printDialog.ShowDialog() == true) { FlowDocument fd = DocumentPrinter.CreateFlowDocumentForEditor(this); PrintPreviewViewContent.ApplySettingsToFlowDocument(printDialog, fd); IDocumentPaginatorSource doc = fd; printDialog.PrintDocument(doc.DocumentPaginator, Path.GetFileName(this.FileName)); } }
void OnPrint(object sender, ExecutedRoutedEventArgs e) { PrintDialog printDialog = PrintPreviewViewContent.PrintDialog; if (printDialog.ShowDialog() == true) { FlowDocument fd = DocumentPrinter.CreateFlowDocumentForEditor(this); fd.ColumnGap = 0; fd.ColumnWidth = printDialog.PrintableAreaWidth; fd.PageHeight = printDialog.PrintableAreaHeight; fd.PageWidth = printDialog.PrintableAreaWidth; IDocumentPaginatorSource doc = fd; printDialog.PrintDocument(doc.DocumentPaginator, Path.GetFileName(this.FileName)); } }