Beispiel #1
0
        public static void HideDialgo()
        {
            // ExStart:HideDialgo
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            // Create PdfViewer object and bind PDF file
            PdfViewer pdfViewer = new PdfViewer();

            pdfViewer.BindPdf(dataDir + "input.pdf");

            // Set PrinterSettings and PageSettings
            System.Drawing.Printing.PrinterSettings printerSetttings = new System.Drawing.Printing.PrinterSettings();
            printerSetttings.Copies      = 1;
            printerSetttings.PrinterName = "Microsoft XPS Document Writer";

            // Set output file name and PrintToFile attribute
            printerSetttings.PrintFileName = dataDir + "print_out_.xps";
            printerSetttings.PrintToFile   = true;

            // Disable print page dialog
            pdfViewer.PrintPageDialog = false;

            // Pass printer settings object to the method
            pdfViewer.PrintDocumentWithSettings(printerSetttings);
            pdfViewer.Close();
            // ExEnd:HideDialgo
        }
Beispiel #2
0
        public void print1(string printerName, string filePath)
        {
            // string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();
            // Create PdfViewer object
            PdfViewer viewer = new PdfViewer();

            // Open input PDF file
            viewer.BindPdf(filePath);
            // Set attributes for printing
            viewer.AutoResize      = true;    // Print the file with adjusted size
            viewer.AutoRotate      = true;    // Print the file with adjusted rotation
            viewer.PrintPageDialog = false;   // Do not produce the page number dialog when printing
            // Create objects for printer and page settings and PrintDocument
            System.Drawing.Printing.PrinterSettings ps     = new System.Drawing.Printing.PrinterSettings();
            System.Drawing.Printing.PageSettings    pgs    = new System.Drawing.Printing.PageSettings();
            System.Drawing.Printing.PrintDocument   prtdoc = new System.Drawing.Printing.PrintDocument();
            // Set printer name
            ps.PrinterName = prtdoc.PrinterSettings.PrinterName;
            // Set PageSize (if required)
            pgs.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 280, 826);
            // Set PageMargins (if required)
            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            // ExStart:PrintDialog
            //System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
            //if (printDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            //{
            // Document printing code goes here
            // Print document using printer and page settings
            viewer.PrintDocumentWithSettings(pgs, ps);
            //}
            // ExEnd:PrintDialog
            // Close the PDF file after priting
            viewer.Close();
        }
 public static void GetSetPrintOwnerName()
 {
     // ExStart:GetSetPrintOwnerName
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();
     PdfViewer viewer = new PdfViewer();
     // Bind source PDF file
     viewer.BindPdf(dataDir + "input.pdf");
     // Specify the name of Print job
     viewer.PrinterJobName = GetCurrentUserCredentials();
     // ExEnd:GetSetPrintOwnerName
 }
        public static void GetSetPrintOwnerName()
        {
            // ExStart:GetSetPrintOwnerName
            // The path to the documents directory.
            string    dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();
            PdfViewer viewer  = new PdfViewer();

            // Bind source PDF file
            viewer.BindPdf(dataDir + "input.pdf");
            // Specify the name of Print job
            viewer.PrinterJobName = GetCurrentUserCredentials();
            // ExEnd:GetSetPrintOwnerName
        }
        public void Print(string pdfFileName, string printer, bool IsDupex = true)
        {
            viewer = new PdfViewer();

            viewer.BindPdf(pdfFileName);
            viewer.AutoResize      = true;
            viewer.AutoRotate      = true;
            viewer.PrintPageDialog = false;

            PrinterSettings ps = new PrinterSettings();

            ps.PrinterName = printer;
            ps.Duplex      = IsDupex ? Duplex.Vertical : Duplex.Default;

            viewer.PrintDocumentWithSettings(ps);
            //viewer.PrintDocument();
        }
Beispiel #6
0
        //Button Action testseite drucken
        public IActionResult TestPrinter(string PrinterName)
        {
            if (ModelState.IsValid)
            {
                string folderPath = @"C:\Users\BenOmran\Desktop\savepdf";
                PrinterList = GetAllItems().ToList();

                var printer = PrinterList.Single(d => d.DeviceName == PrinterName);

                if (printer.DeviceType == "Printer" && printer.DeviceSubtype == "A4")
                {
                    FileStream        PdfA4            = new FileStream("Test-A4.pdf", FileMode.Open, FileAccess.Read);
                    PdfLoadedDocument loadedDocumentA4 = new PdfLoadedDocument(PdfA4);
                    MemoryStream      stream           = new MemoryStream();
                    loadedDocumentA4.Save(stream);
                    PdfViewer pdfViewer = new PdfViewer();

                    var myUniqueFileName = $@"Test-A4_{Guid.NewGuid()}.pdf";
                    using (var file = new FileStream(Path.Combine(folderPath, myUniqueFileName), FileMode.Create, FileAccess.Write))
                    {
                        stream.WriteTo(file);
                        pdfViewer.BindPdf(PdfA4);
                        pdfViewer.PrintDocument();
                        AddQ(PrinterName, file.Name);
                    }
                }
                else if (printer.DeviceType == "Printer" && printer.DeviceSubtype == "Label")
                {
                    FileStream        PdfLabel            = new FileStream("Test-Label-3,9x7,9-inch.pdf", FileMode.Open, FileAccess.Read);
                    PdfLoadedDocument loadedDocumentLabel = new PdfLoadedDocument(PdfLabel);
                    MemoryStream      stream = new MemoryStream();
                    loadedDocumentLabel.Save(stream);
                    PdfViewer pdfViewer = new PdfViewer();

                    var myUniqueFileName = $@"Test-Label-3,9x7,9-inch_{Guid.NewGuid()}.pdf";
                    using (var file = new FileStream(Path.Combine(folderPath, myUniqueFileName), FileMode.Create, FileAccess.Write))
                    {
                        stream.WriteTo(file);
                        pdfViewer.BindPdf(PdfLabel);
                        pdfViewer.PrintDocument();
                        AddQ(PrinterName, file.Name);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
        public static void FontsNotEmbedded()
        {
            
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            // Create PdfViewer object
            PdfViewer viewer = new PdfViewer();

            // Open input PDF file
            viewer.BindPdf(dataDir + "input.pdf");

            // Set attributes for printing
            viewer.AutoResize = true;         // Print the file with adjusted size
            viewer.AutoRotate = true;         // Print the file with adjusted rotation
            viewer.PrintPageDialog = false;   // Do not produce the page number dialog when printing

            // Create objects for printer and page settings and PrintDocument
            System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
            System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

            // Set XPS/PDF printer name
            ps.PrinterName = "Microsoft XPS Document Writer";
            // Or set the PDF printer
            // Ps.PrinterName = "Adobe PDF";

            // Set PageSize (if required)
            pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

            // Set PageMargins (if required)
            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            
            // ExStart:FontsNotEmbedded
            // Render all system fonts with native system approach (embed the fonts to output documents)
            viewer.RenderingOptions.SystemFontsNativeRendering = true;
            // ExEnd:FontsNotEmbedded

            // Print document using printer and page settings
            viewer.PrintDocumentWithSettings(pgs, ps);

            // Close the PDF file after priting
            viewer.Close();
        }
        // ExEnd:GetCurrentUserCredentials
        public static void UsingImpersonation()
        {
            // ExStart:UsingImpersonation
            // The path to the documents directory.
            string    dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();
            PdfViewer viewer  = new PdfViewer();

            viewer.BindPdf(dataDir + "input.pdf");
            viewer.PrintPageDialog = false;
            // Do not produce the page number dialog when printing
            using (new Impersonator("OwnerUserName", "SomeDomain", "OwnerUserNamePassword"))
            {
                System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
                ps.PrinterName = "Microsoft XPS Document Writer";
                viewer.PrintDocumentWithSettings(ps); // OwnerUserName is a value of Owner column in spooler app
                viewer.Close();
            }
            // ExEnd:UsingImpersonation
        }
        public static void ShowPrintDialog()
        {
          
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            // Create PdfViewer object
            PdfViewer viewer = new PdfViewer();

            // Open input PDF file
            viewer.BindPdf( dataDir + "input.pdf");

            // Set attributes for printing
            viewer.AutoResize = true;         // Print the file with adjusted size
            viewer.AutoRotate = true;         // Print the file with adjusted rotation
            viewer.PrintPageDialog = false;   // Do not produce the page number dialog when printing

            // Create objects for printer and page settings and PrintDocument
            System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
            System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
            System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();

            // Set printer name
            ps.PrinterName = prtdoc.PrinterSettings.PrinterName;

            // Set PageSize (if required)
            pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

            // Set PageMargins (if required)
            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            // ExStart:PrintDialog
            System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
            if (printDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Document printing code goes here
                // Print document using printer and page settings
                viewer.PrintDocumentWithSettings(pgs, ps);
            }
            // ExEnd:PrintDialog            

            // Close the PDF file after priting
            viewer.Close();
        }
Beispiel #10
0
        public static void FontsNotEmbedded()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            // Create PdfViewer object
            PdfViewer viewer = new PdfViewer();

            // Open input PDF file
            viewer.BindPdf(dataDir + "input.pdf");

            // Set attributes for printing
            viewer.AutoResize      = true;    // Print the file with adjusted size
            viewer.AutoRotate      = true;    // Print the file with adjusted rotation
            viewer.PrintPageDialog = false;   // Do not produce the page number dialog when printing

            // Create objects for printer and page settings and PrintDocument
            System.Drawing.Printing.PrinterSettings ps  = new System.Drawing.Printing.PrinterSettings();
            System.Drawing.Printing.PageSettings    pgs = new System.Drawing.Printing.PageSettings();

            // Set XPS/PDF printer name
            ps.PrinterName = "Microsoft XPS Document Writer";
            // or set the PDF printer
            // ps.PrinterName = "Adobe PDF";

            // Set PageSize (if required)
            pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

            // Set PageMargins (if required)
            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

            // ExStart:FontsNotEmbedded
            // Render all system fonts with native system approach (embed the fonts to output documents)
            viewer.RenderingOptions.SystemFontsNativeRendering = true;
            // ExEnd:FontsNotEmbedded

            // Print document using printer and page settings
            viewer.PrintDocumentWithSettings(pgs, ps);

            // Close the PDF file after priting
            viewer.Close();
        }
Beispiel #11
0
        public static void Run()
        {
            // ExStart:PrintToDefaultPrinter
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            // Create PdfViewer object
            PdfViewer viewer = new PdfViewer();

            // Open input PDF file
            viewer.BindPdf(dataDir + "input.pdf");

            // Set attributes for printing
            viewer.AutoResize      = true;    // Print the file with adjusted size
            viewer.AutoRotate      = true;    // Print the file with adjusted rotation
            viewer.PrintPageDialog = false;   // Do not produce the page number dialog when printing

            // Create objects for printer and page settings and PrintDocument
            System.Drawing.Printing.PrinterSettings ps     = new System.Drawing.Printing.PrinterSettings();
            System.Drawing.Printing.PageSettings    pgs    = new System.Drawing.Printing.PageSettings();
            System.Drawing.Printing.PrintDocument   prtdoc = new System.Drawing.Printing.PrintDocument();

            // Set printer name
            ps.PrinterName = prtdoc.PrinterSettings.PrinterName;

            // Set PageSize (if required)
            pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

            // Set PageMargins (if required)
            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

            // Print document using printer and page settings
            viewer.PrintDocumentWithSettings(pgs, ps);

            // Close the PDF file after priting
            viewer.Close();
            // ExEnd:PrintToDefaultPrinter
        }
        // ExEnd:PrintingJobSettings
        public static void Run()
        {
            // ExStart:PrintPages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            int    printingJobIndex = 0;
            string inPdf            = dataDir + "input.pdf";
            string output           = dataDir;
            IList <PrintingJobSettings> printingJobs = new List <PrintingJobSettings>();

            PrintingJobSettings printingJob1 = new PrintingJobSettings();

            printingJob1.FromPage   = 1;
            printingJob1.ToPage     = 3;
            printingJob1.OutputFile = output + "35925_1_3.xps";
            printingJob1.Mode       = Duplex.Default;

            printingJobs.Add(printingJob1);

            PrintingJobSettings printingJob2 = new PrintingJobSettings();

            printingJob2.FromPage   = 4;
            printingJob2.ToPage     = 6;
            printingJob2.OutputFile = output + "35925_4_6.xps";
            printingJob2.Mode       = Duplex.Simplex;

            printingJobs.Add(printingJob2);

            PrintingJobSettings printingJob3 = new PrintingJobSettings();

            printingJob3.FromPage   = 7;
            printingJob3.ToPage     = 7;
            printingJob3.OutputFile = output + "35925_7.xps";
            printingJob3.Mode       = Duplex.Default;

            printingJobs.Add(printingJob3);

            PdfViewer viewer = new PdfViewer();

            viewer.BindPdf(inPdf);
            viewer.AutoResize      = true;
            viewer.AutoRotate      = true;
            viewer.PrintPageDialog = false;

            PrinterSettings ps  = new PrinterSettings();
            PageSettings    pgs = new PageSettings();

            ps.PrinterName   = "Microsoft XPS Document Writer";
            ps.PrintFileName = Path.GetFullPath(printingJobs[printingJobIndex].OutputFile);
            ps.PrintToFile   = true;
            ps.FromPage      = printingJobs[printingJobIndex].FromPage;
            ps.ToPage        = printingJobs[printingJobIndex].ToPage;
            ps.Duplex        = printingJobs[printingJobIndex].Mode;
            ps.PrintRange    = PrintRange.SomePages;

            pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);
            ps.DefaultPageSettings.PaperSize = pgs.PaperSize;
            pgs.Margins      = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            viewer.EndPrint += (sender, args) =>
            {
                if (++printingJobIndex < printingJobs.Count)
                {
                    ps.PrintFileName = Path.GetFullPath(printingJobs[printingJobIndex].OutputFile);
                    ps.FromPage      = printingJobs[printingJobIndex].FromPage;
                    ps.ToPage        = printingJobs[printingJobIndex].ToPage;
                    ps.Duplex        = printingJobs[printingJobIndex].Mode;
                    viewer.PrintDocumentWithSettings(pgs, ps);
                }
            };

            viewer.PrintDocumentWithSettings(pgs, ps);
            // ExEnd:PrintPages
        }
        // ExEnd:PrintingJobSettings
        public static void Run()
        {
            // ExStart:PrintPages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            int printingJobIndex = 0;
            string inPdf = dataDir + "input.pdf";
            string output = dataDir;
            IList<PrintingJobSettings> printingJobs = new List<PrintingJobSettings>();

            PrintingJobSettings printingJob1 = new PrintingJobSettings();
            printingJob1.FromPage = 1;
            printingJob1.ToPage = 3;
            printingJob1.OutputFile = output + "35925_1_3.xps";
            printingJob1.Mode = Duplex.Default;

            printingJobs.Add(printingJob1);

            PrintingJobSettings printingJob2 = new PrintingJobSettings();
            printingJob2.FromPage = 4;
            printingJob2.ToPage = 6;
            printingJob2.OutputFile = output + "35925_4_6.xps";
            printingJob2.Mode = Duplex.Simplex;

            printingJobs.Add(printingJob2);

            PrintingJobSettings printingJob3 = new PrintingJobSettings();
            printingJob3.FromPage = 7;
            printingJob3.ToPage = 7;
            printingJob3.OutputFile = output + "35925_7.xps";
            printingJob3.Mode = Duplex.Default;

            printingJobs.Add(printingJob3);

            PdfViewer viewer = new PdfViewer();

            viewer.BindPdf(inPdf);
            viewer.AutoResize = true;
            viewer.AutoRotate = true;
            viewer.PrintPageDialog = false;

            PrinterSettings ps = new PrinterSettings();
            PageSettings pgs = new PageSettings();

            ps.PrinterName = "Microsoft XPS Document Writer";
            ps.PrintFileName = Path.GetFullPath(printingJobs[printingJobIndex].OutputFile);
            ps.PrintToFile = true;
            ps.FromPage = printingJobs[printingJobIndex].FromPage;
            ps.ToPage = printingJobs[printingJobIndex].ToPage;
            ps.Duplex = printingJobs[printingJobIndex].Mode;
            ps.PrintRange = PrintRange.SomePages;

            pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);
            ps.DefaultPageSettings.PaperSize = pgs.PaperSize;
            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            viewer.EndPrint += (sender, args) =>
            {
                if (++printingJobIndex < printingJobs.Count)
                {
                    ps.PrintFileName = Path.GetFullPath(printingJobs[printingJobIndex].OutputFile);
                    ps.FromPage = printingJobs[printingJobIndex].FromPage;
                    ps.ToPage = printingJobs[printingJobIndex].ToPage;
                    ps.Duplex = printingJobs[printingJobIndex].Mode;
                    viewer.PrintDocumentWithSettings(pgs, ps);
                }
            };

            viewer.PrintDocumentWithSettings(pgs, ps);
            // ExEnd:PrintPages
        }    
 // ExEnd:GetCurrentUserCredentials
 public static void UsingImpersonation()
 {
     // ExStart:UsingImpersonation
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();
     PdfViewer viewer = new PdfViewer();
     viewer.BindPdf( dataDir + "input.pdf");
     viewer.PrintPageDialog = false;
     // Do not produce the page number dialog when printing
     using (new Impersonator("OwnerUserName", "SomeDomain", "OwnerUserNamePassword"))
     {
         System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
         ps.PrinterName = "Microsoft XPS Document Writer";
         viewer.PrintDocumentWithSettings(ps); // OwnerUserName is a value of Owner column in spooler app
         viewer.Close();
     }
     // ExEnd:UsingImpersonation
 }
        public static void Run()
        {
            try
            {
                // ExStart:CheckPrintJobStatus
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

                // Instantiate PdfViewer object
                PdfViewer viewer = new PdfViewer();

                // Bind source PDF file
                viewer.BindPdf(dataDir + "input.pdf");
                viewer.AutoResize = true;

                // Hide printing dialog
                viewer.PrintPageDialog = false;

                // Create Printer Settings object
                System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
                System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
                System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();

                // Specify the printer anme
                ps.PrinterName = "Microsoft XPS Document Writer";

                // Resultant Printout name
                ps.PrintFileName = "ResultantPrintout.xps";

                // Print the output to file
                ps.PrintToFile = true;
                ps.FromPage = 1;
                ps.ToPage = 2;
                ps.PrintRange = System.Drawing.Printing.PrintRange.SomePages;

                // Specify the page size of printout
                pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);
                ps.DefaultPageSettings.PaperSize = pgs.PaperSize;
                pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

                // Print the document with settings specified above
                viewer.PrintDocumentWithSettings(pgs, ps);

                // Check the print status
                if (viewer.PrintStatus != null)
                {
                    // An exception was thrown
                    Exception ex = viewer.PrintStatus as Exception;
                    if (ex != null)
                    {
                        // Get exception message
                    }
                }
                else
                {
                    // No errors were found. Printing job has completed successfully
                    Console.WriteLine("printing completed without any issue..");
                }
                // ExEnd:CheckPrintJobStatus
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void Run()
        {
            try
            {
                // ExStart:CheckPrintJobStatus
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

                // Instantiate PdfViewer object
                PdfViewer viewer = new PdfViewer();

                // Bind source PDF file
                viewer.BindPdf(dataDir + "input.pdf");
                viewer.AutoResize = true;

                // Hide printing dialog
                viewer.PrintPageDialog = false;

                // Create Printer Settings object
                System.Drawing.Printing.PrinterSettings ps     = new System.Drawing.Printing.PrinterSettings();
                System.Drawing.Printing.PageSettings    pgs    = new System.Drawing.Printing.PageSettings();
                System.Drawing.Printing.PrintDocument   prtdoc = new System.Drawing.Printing.PrintDocument();

                // Specify the printer anme
                ps.PrinterName = "Microsoft XPS Document Writer";

                // Resultant Printout name
                ps.PrintFileName = "ResultantPrintout.xps";

                // Print the output to file
                ps.PrintToFile = true;
                ps.FromPage    = 1;
                ps.ToPage      = 2;
                ps.PrintRange  = System.Drawing.Printing.PrintRange.SomePages;

                // Specify the page size of printout
                pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);
                ps.DefaultPageSettings.PaperSize = pgs.PaperSize;
                pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

                // Print the document with settings specified above
                viewer.PrintDocumentWithSettings(pgs, ps);

                // Check the print status
                if (viewer.PrintStatus != null)
                {
                    // An exception was thrown
                    Exception ex = viewer.PrintStatus as Exception;
                    if (ex != null)
                    {
                        // Get exception message
                    }
                }
                else
                {
                    // No errors were found. Printing job has completed successfully
                    Console.WriteLine("printing completed without any issue..");
                }
                // ExEnd:CheckPrintJobStatus
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void HideDialgo()
        {
            // ExStart:HideDialgo
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            // Create PdfViewer object and bind PDF file
            PdfViewer pdfViewer = new PdfViewer();
            pdfViewer.BindPdf( dataDir + "input.pdf");

            // Set PrinterSettings and PageSettings
            System.Drawing.Printing.PrinterSettings printerSetttings = new System.Drawing.Printing.PrinterSettings();
            printerSetttings.Copies = 1;
            printerSetttings.PrinterName = "Microsoft XPS Document Writer";

            // Set output file name and PrintToFile attribute
            printerSetttings.PrintFileName = dataDir + "print_out.xps";
            printerSetttings.PrintToFile = true;

            // Disable print page dialog
            pdfViewer.PrintPageDialog = false;

            // Pass printer settings object to the method
            pdfViewer.PrintDocumentWithSettings(printerSetttings);
            pdfViewer.Close();
            // ExEnd:HideDialgo
        }