Beispiel #1
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     isDisposeCalled = true;
     if (pageTimer.Enabled)
     {
         pageTimer.Stop();
     }
     docViewer.Dispose();
     pdfDocumentView1.Dispose();
     pdfDocumentView2.Dispose();
     pdfDocumentView3.Dispose();
     if (disposing && (components != null))
     {
         components.Dispose();
     }
     base.Dispose(disposing);
 }
        static void Main(string[] args)
        {
            PdfDocumentView viewer = new PdfDocumentView();

            //Load the PDF document
            viewer.Load("../../../Data/Barcode.pdf");

            //Initialize print dialog.
            PrintDialog dialog = new PrintDialog();

            dialog.AllowPrintToFile = true;

            dialog.AllowSomePages = true;

            dialog.AllowCurrentPage = true;

            dialog.Document = viewer.PrintDocument;

            //Print the PDF document
            dialog.Document.Print();

            //Dispose the viewer
            viewer.Dispose();
        }