public void Print()
{
#if !__MonoCS__
var arc = _pdfViewerControl as AdobeReaderControl;
if (arc != null)
{
// The print button is only enabled after we have generated a PDF and tried to display it,
// so if we still have an ARC by this point, it displayed successfully, and presumably can also print.
arc.Print();
return;
}
// PDFjs printing has proved unreliable, so GhostScript is preferable even on Windows.
if (TryGhostcriptPrint())
return;
var browser = ((GeckoWebBrowser)_pdfViewerControl);
using (AutoJSContext context = new AutoJSContext(browser.Window))
{
string result;
context.EvaluateScript(@"window.print()", (nsISupports)browser.Document.DomObject, out result);
}
#else
// on Linux the isntaller will have a dependency on GhostScript so it should always be available.
// We've had many problems with PDFJs so hopefully this solves them.
if (TryGhostcriptPrint())
return;
// BL-788 Print dialog appears behind Bloom on Linux
// Finally went to minimizing Bloom to allow the print window to be
// displayed and then restore to the original size after the
// Print or Cancel button is pushed on the print dialog.
_pauseTimer = new Timer();
_pauseTimer.Interval = 250;
_pauseTimer.Tick += PrintAfterPause;
_savedState = this.ParentForm.WindowState;
this.ParentForm.WindowState = FormWindowState.Minimized;
_pauseTimer.Start();
#endif
}