PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == true) { System.Printing.PrintCapabilities capabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket); // double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth / myscrollvier.ActualWidth, capabilities.PageImageableArea.ExtentHeight / //myscrollvier.ActualHeight); var x1 = flowDocument.PageWidth; var x2 = flowDocument.PageHeight; flowDocument.PageHeight = capabilities.PageImageableArea.ExtentHeight; flowDocument.PageWidth = capabilities.PageImageableArea.ExtentWidth; printDialog.PrintDocument(((IDocumentPaginatorSource)flowDocument).DocumentPaginator, "Flow Document Print Job"); flowDocument.PageHeight = x2; flowDocument.PageWidth = x1; }
private void Button_Click(object sender, RoutedEventArgs e) { PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == true) { System.Printing.PrintCapabilities capabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket); // double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth / myscrollvier.ActualWidth, capabilities.PageImageableArea.ExtentHeight / //myscrollvier.ActualHeight); var x1 = flowDocument.PageWidth; var x2 = flowDocument.PageHeight; flowDocument.PageHeight = capabilities.PageImageableArea.ExtentHeight; flowDocument.PageWidth = capabilities.PageImageableArea.ExtentWidth; printDialog.PrintDocument(((IDocumentPaginatorSource)flowDocument).DocumentPaginator, "Flow Document Print Job"); flowDocument.PageHeight = x2; flowDocument.PageWidth = x1; } }