Example #1
0
        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);
            }
        }
Example #2
0
 public bool Print()
 {
     if (pdfDoc == null)
     {
         return(false);
     }
     else
     {
         return(PrinterUtil.PrintImagesToPrinter(pdfDoc));
     }
 }
Example #3
0
 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);
     }
 }
Example #4
0
 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;
 }