public static void Run() { // ExStart:PrintMultiplePagesOnOneSheet // The path to the documents directory. string dataDir = RunExamples.GetDataDir_RenderingAndPrinting(); // Open the document. Document doc = new Document(dataDir + "TestFile.doc"); // ExStart:PrintDialogSettings PrintDialog printDlg = new PrintDialog(); // Initialize the Print Dialog with the number of pages in the document. printDlg.AllowSomePages = true; printDlg.PrinterSettings.MinimumPage = 1; printDlg.PrinterSettings.MaximumPage = doc.PageCount; printDlg.PrinterSettings.FromPage = 1; printDlg.PrinterSettings.ToPage = doc.PageCount; // ExEnd:PrintDialogSettings // Check if user accepted the print settings and proceed to preview. // ExStart:CheckPrintSettings if (!printDlg.ShowDialog().Equals(DialogResult.OK)) { return; } // ExEnd:CheckPrintSettings // Pass the printer settings from the dialog to the print document. MultipagePrintDocument awPrintDoc = new MultipagePrintDocument(doc, 4, true); awPrintDoc.PrinterSettings = printDlg.PrinterSettings; // ExStart:ActivePrintPreviewDialog // Create and configure the the ActivePrintPreviewDialog class. ActivePrintPreviewDialog previewDlg = new ActivePrintPreviewDialog(); previewDlg.Document = awPrintDoc; // Specify additional parameters of the Print Preview dialog. previewDlg.ShowInTaskbar = true; previewDlg.MinimizeBox = true; previewDlg.Document.DocumentName = "TestFile.doc"; previewDlg.WindowState = FormWindowState.Maximized; // Show appropriately configured Print Preview dialog. previewDlg.ShowDialog(); // ExEnd:ActivePrintPreviewDialog // ExEnd:PrintMultiplePagesOnOneSheet }
public static void Run() { // ExStart:PrintMultiplePagesOnOneSheet // The path to the documents directory. string dataDir = RunExamples.GetDataDir_RenderingAndPrinting(); // Open the document. Document doc = new Document(dataDir + "TestFile.doc"); // ExStart:PrintDialogSettings PrintDialog printDlg = new PrintDialog(); // Initialize the Print Dialog with the number of pages in the document. printDlg.AllowSomePages = true; printDlg.PrinterSettings.MinimumPage = 1; printDlg.PrinterSettings.MaximumPage = doc.PageCount; printDlg.PrinterSettings.FromPage = 1; printDlg.PrinterSettings.ToPage = doc.PageCount; // ExEnd:PrintDialogSettings // Check if user accepted the print settings and proceed to preview. // ExStart:CheckPrintSettings if (!printDlg.ShowDialog().Equals(DialogResult.OK)) return; // ExEnd:CheckPrintSettings // Pass the printer settings from the dialog to the print document. MultipagePrintDocument awPrintDoc = new MultipagePrintDocument(doc, 4, true); awPrintDoc.PrinterSettings = printDlg.PrinterSettings; // ExStart:ActivePrintPreviewDialog // Create and configure the the ActivePrintPreviewDialog class. ActivePrintPreviewDialog previewDlg = new ActivePrintPreviewDialog(); previewDlg.Document = awPrintDoc; // Specify additional parameters of the Print Preview dialog. previewDlg.ShowInTaskbar = true; previewDlg.MinimizeBox = true; previewDlg.Document.DocumentName = "TestFile.doc"; previewDlg.WindowState = FormWindowState.Maximized; // Show appropriately configured Print Preview dialog. previewDlg.ShowDialog(); // ExEnd:ActivePrintPreviewDialog // ExEnd:PrintMultiplePagesOnOneSheet }