public void PrintDiagPrint(object PrintDiag) { bool print_all = false; int first_page = 1; int last_page = 1; if (!m_printcontrol.RangeOK()) { return; } /* Create only the page range that is needed. */ switch (m_printcontrol.m_pages_setting) { case PrintPages_t.RANGE: first_page = m_printcontrol.m_from; last_page = m_printcontrol.m_to; break; case PrintPages_t.CURRENT: first_page = m_currpage + 1; last_page = m_currpage + 1; break; case PrintPages_t.ALL: print_all = true; first_page = 1; last_page = m_numpages; break; } /* Show the progress bar dialog */ m_printstatus = new PrintStatus(); m_printstatus.Activate(); m_printstatus.Show(); string extension = System.IO.Path.GetExtension(m_currfile); /* If file is already xps then gs need not do this */ /* We are doing this based on the extension but like should do * it based upon the content */ if (!(String.Equals(extension.ToUpper(), "XPS") || String.Equals(extension.ToUpper(), "OXPS"))) { m_printstatus.xaml_PrintProgress.Value = 0; if (m_ghostscript.CreateXPS(m_currfile, Constants.DEFAULT_GS_RES, last_page - first_page + 1, m_printcontrol, first_page, last_page) == gsStatus.GS_BUSY) { ShowMessage(NotifyType_t.MESS_STATUS, "GS currently busy"); return; } } else { PrintXPS(m_currfile, print_all, first_page, last_page, false); } }
public void PrintDiagPrint(object PrintDiag) { bool print_all = false; int first_page = 1; int last_page = 1; if (!m_printcontrol.RangeOK()) { return; } /* Create only the page range that is needed. */ switch (m_printcontrol.m_pages_setting) { case PrintPages_t.RANGE: first_page = m_printcontrol.m_from; last_page = m_printcontrol.m_to; break; case PrintPages_t.CURRENT: first_page = m_currpage + 1; last_page = m_currpage + 1; break; case PrintPages_t.ALL: print_all = true; first_page = 1; last_page = m_numpages; break; } /* Show the progress bar dialog */ m_printstatus = new PrintStatus(); m_printstatus.Activate(); m_printstatus.Show(); string extension = System.IO.Path.GetExtension(m_currfile); /* If file is already xps then gs need not do this */ /* We are doing this based on the extension but should do * it based upon the content */ if (!(String.Equals(extension.ToUpper(), "XPS") || String.Equals(extension.ToUpper(), "OXPS"))) { m_printstatus.xaml_PrintProgress.Value = 0; /* Extract needed information from print dialog and pass to GSNET */ if (m_printcontrol == null) { return; } else { double width; double height; bool fit_page = (m_printcontrol.xaml_autofit.IsChecked == true); if (m_printcontrol.m_pagedetails.Landscape == true) { height = m_printcontrol.m_pagedetails.PrintableArea.Width * 72.0 / 100.0; width = m_printcontrol.m_pagedetails.PrintableArea.Height * 72.0 / 100.0; } else { height = m_printcontrol.m_pagedetails.PrintableArea.Height * 72.0 / 100.0; width = m_printcontrol.m_pagedetails.PrintableArea.Width * 72.0 / 100.0; } if (m_ghostscript.CreateXPS(m_currfile, Constants.DEFAULT_GS_RES, last_page - first_page + 1, height, width, fit_page, first_page, last_page) == gsStatus.GS_BUSY) { ShowMessage(NotifyType_t.MESS_STATUS, "GS currently busy"); return; } } } else { PrintXPS(m_currfile, print_all, first_page, last_page, false); } }