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));
        }
Esempio n. 2
0
        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));
            }
        }
        public static void ShowDocument(IDocumentPaginatorSource document, string description)
        {
            PrintPreviewViewContent vc = WorkbenchSingleton.Workbench.ViewContentCollection.OfType <PrintPreviewViewContent>().FirstOrDefault();

            if (vc != null)
            {
                vc.WorkbenchWindow.SelectWindow();
            }
            else
            {
                vc = new PrintPreviewViewContent();
                WorkbenchSingleton.Workbench.ShowView(vc);
            }
            vc.Document    = document;
            vc.Description = description;
        }
		public static void ShowDocument(IDocumentPaginatorSource document, string description)
		{
			PrintPreviewViewContent vc = WorkbenchSingleton.Workbench.ViewContentCollection.OfType<PrintPreviewViewContent>().FirstOrDefault();
			if (vc != null) {
				vc.WorkbenchWindow.SelectWindow();
			} else {
				vc = new PrintPreviewViewContent();
				WorkbenchSingleton.Workbench.ShowView(vc);
			}
			vc.Document = document;
			vc.Description = description;
		}