コード例 #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);
            }
        }
コード例 #2
0
ファイル: PDFViewer.cs プロジェクト: jy4618272/PdfViewerNet
 public bool Print()
 {
     if (pdfDoc == null)
     {
         return(false);
     }
     else
     {
         return(PrinterUtil.PrintImagesToPrinter(pdfDoc));
     }
 }
コード例 #3
0
ファイル: PDFViewer.cs プロジェクト: jy4618272/PdfViewerNet
 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);
     }
 }
コード例 #4
0
ファイル: PrinterUtil.cs プロジェクト: mybluevan/PdfViewerNet
 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;
 }