public virtual bool OnFilePrint() { CheckDisposed(); // In case the print layout view has never been displayed, we configure it now. Configure(); using (PrintDialog dlg = new PrintDialog()) { dlg.Reset(); dlg.Document = new PrintDocument(); dlg.AllowSomePages = true; dlg.AllowSelection = false; dlg.ShowHelp = true; dlg.HelpRequest += new EventHandler(ShowPrintDlgHelp); dlg.PrinterSettings.MinimumPage = 1; dlg.PrinterSettings.FromPage = 1; dlg.PrinterSettings.ToPage = 1; // ENHANCE: Would "dlg.UseEXDialog" get us any of the enhancements we need? // ENHANCE: Displaying this dialog is slow (loads a lot of DLLs), at least in Debug // mode. Tried displaying a wait cursor (wrapped around this entire method) but it // didn't work. if (dlg.ShowDialog(this) != DialogResult.OK) return true; if (MiscUtils.IsUnix) dlg.Document.DefaultPageSettings.PaperSize = new PaperSize("Custom", Publication.PaperWidth/720, Publication.PaperHeight/720); // REVIEW: .NET does not appear to handle the collation setting correctly // so for now, we do not support non-collated printing. Forcing the setting // seems to work fine. if (dlg.PrinterSettings.Copies > 1) dlg.Document.PrinterSettings.Collate = true; switch (dlg.PrinterSettings.PrintRange) { case PrintRange.AllPages: m_currentPrintPage = 1; break; case PrintRange.Selection: // TODO: This is not really the selection, for now, it will just print // page 1 because we are not sure what the selection is. Also, we want // to consider not supporting printing the selection. m_currentPrintPage = 1; break; case PrintRange.SomePages: m_currentPrintPage = dlg.PrinterSettings.FromPage; break; } SimpleRootSite.PrintWithErrorHandling(this, dlg.Document, FindForm()); } return true; }