internal static bool PrintImagesToPrinter(PDFLibNet.PDFWrapper pdfDoc) { PrintDialog pd = new PrintDialog(); pd.AllowPrintToFile = false; pd.AllowSomePages = true; pd.PrinterSettings.FromPage = pd.PrinterSettings.MinimumPage = 1; pd.PrinterSettings.ToPage = pd.PrinterSettings.MaximumPage = pdfDoc.PageCount; if (pd.ShowDialog() == DialogResult.OK) { PrintDocument printDocument = new PrintDocument(); printDocument.PrintController = new StandardPrintController(); printDocument.PrinterSettings = pd.PrinterSettings; PrinterUtil printUtil = new PrinterUtil(printDocument, pdfDoc); Cursor.Current = Cursors.WaitCursor; printUtil.printDocument.Print(); bool retVal = printUtil.finishedPrinting; printUtil = null; GC.Collect(); Cursor.Current = Cursors.Default; return(retVal); } else { return(false); } }
public bool Print() { if (pdfDoc == null) { return(false); } else { return(PrinterUtil.PrintImagesToPrinter(pdfDoc)); } }
public bool Print(string filename) { //TODO if (filename != null && filename != "" && ImageUtil.IsPDF(filename)) { PDFLibNet.PDFWrapper tmpDoc = new PDFLibNet.PDFWrapper(""); tmpDoc.LoadPDF(filename); return(PrinterUtil.PrintImagesToPrinter(tmpDoc)); } else { return(false); } }
internal static bool PrintImagesToPrinter(PDFLibNet.PDFWrapper pdfDoc) { PrintDialog pd = new PrintDialog(); pd.AllowPrintToFile = false; pd.AllowSomePages = true; pd.PrinterSettings.FromPage = pd.PrinterSettings.MinimumPage = 1; pd.PrinterSettings.ToPage = pd.PrinterSettings.MaximumPage = pdfDoc.PageCount; if (pd.ShowDialog() == DialogResult.OK) { PrintDocument printDocument = new PrintDocument(); printDocument.PrintController = new StandardPrintController(); printDocument.PrinterSettings = pd.PrinterSettings; PrinterUtil printUtil = new PrinterUtil(printDocument, pdfDoc); Cursor.Current = Cursors.WaitCursor; printUtil.printDocument.Print(); bool retVal = printUtil.finishedPrinting; printUtil = null; GC.Collect(); Cursor.Current = Cursors.Default; return retVal; } else return false; }