コード例 #1
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            Aspose.Pdf.Facades.PdfViewer pdfv = new Aspose.Pdf.Facades.PdfViewer();

            pdfv.PdfQueryPageSettings += PdfvOnPdfQueryPageSettings;

            System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
            System.Drawing.Printing.PrinterSettings prin = new System.Drawing.Printing.PrinterSettings();

            pdfv.BindPdf(dataDir + "NewInput.pdf");
            prin.PrinterName = "HP LaserJet M9050 MFP PCL6";
            prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

            Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor();
            pageEditor.BindPdf(dataDir+ "temp.pdf");

            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            pgs.PaperSize = prin.DefaultPageSettings.PaperSize;

            pdfv.PrintDocumentWithSettings(pgs, prin);
            pdfv.Close();
        }
コード例 #2
0
        public static void Run()
        {
            try
            {
                // ExStart:PrintPageRange
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

                Aspose.Pdf.Facades.PdfViewer pdfv = new Aspose.Pdf.Facades.PdfViewer();

                pdfv.PdfQueryPageSettings += PdfvOnPdfQueryPageSettings;

                System.Drawing.Printing.PageSettings    pgs  = new System.Drawing.Printing.PageSettings();
                System.Drawing.Printing.PrinterSettings prin = new System.Drawing.Printing.PrinterSettings();

                pdfv.BindPdf(dataDir + "Print-PageRange.pdf");
                prin.PrinterName = "HP LaserJet M9050 MFP PCL6";
                prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

                Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor();
                pageEditor.BindPdf(dataDir + "input.pdf");

                pgs.Margins   = new System.Drawing.Printing.Margins(0, 0, 0, 0);
                pgs.PaperSize = prin.DefaultPageSettings.PaperSize;

                pdfv.PrintDocumentWithSettings(pgs, prin);
                pdfv.Close();
                // ExEnd:PrintPageRange
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #3
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            Aspose.Pdf.Facades.PdfViewer pdfv = new Aspose.Pdf.Facades.PdfViewer();

            pdfv.PdfQueryPageSettings += PdfvOnPdfQueryPageSettings;

            System.Drawing.Printing.PageSettings    pgs  = new System.Drawing.Printing.PageSettings();
            System.Drawing.Printing.PrinterSettings prin = new System.Drawing.Printing.PrinterSettings();

            pdfv.BindPdf(dataDir + "NewInput.pdf");
            prin.PrinterName = "HP LaserJet M9050 MFP PCL6";
            prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

            Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor();
            pageEditor.BindPdf(dataDir + "temp.pdf");

            pgs.Margins   = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            pgs.PaperSize = prin.DefaultPageSettings.PaperSize;

            pdfv.PrintDocumentWithSettings(pgs, prin);
            pdfv.Close();
        }
コード例 #4
0
        public static void Run()
        {
            try
            {
                // ExStart:PdfToPostScript
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

                Aspose.Pdf.Facades.PdfViewer viewer = new Aspose.Pdf.Facades.PdfViewer();
                viewer.BindPdf(dataDir + "input.pdf");
                // Set PrinterSettings and PageSettings
                System.Drawing.Printing.PrinterSettings printerSetttings = new System.Drawing.Printing.PrinterSettings();
                printerSetttings.Copies = 1;
                // Set PS printer, one can find this driver in the list of preinstalled printer drivers in Windows
                printerSetttings.PrinterName = "HP LaserJet 2300 Series PS";
                // Set output file name and PrintToFile attribute
                printerSetttings.PrintFileName = dataDir + "PdfToPostScript_out.ps";
                printerSetttings.PrintToFile   = true;
                // Disable print page dialog
                viewer.PrintPageDialog = false;
                // Pass printer settings object to the method
                viewer.PrintDocumentWithSettings(printerSetttings);
                viewer.Close();
                // ExEnd:PdfToPostScript
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #5
0
        public static void Run()
        {
            try
            {
                // ExStart:PdfToPostScript
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

                Aspose.Pdf.Facades.PdfViewer viewer = new Aspose.Pdf.Facades.PdfViewer();
                viewer.BindPdf(dataDir + "input.pdf");
                // Set PrinterSettings and PageSettings
                System.Drawing.Printing.PrinterSettings printerSetttings = new System.Drawing.Printing.PrinterSettings();
                printerSetttings.Copies = 1;
                // Set PS printer, one can find this driver in the list of preinstalled printer drivers in Windows
                printerSetttings.PrinterName = "HP LaserJet 2300 Series PS";
                // Set output file name and PrintToFile attribute
                printerSetttings.PrintFileName = dataDir + "PdfToPostScript_out.ps";
                printerSetttings.PrintToFile = true;
                // Disable print page dialog
                viewer.PrintPageDialog = false;
                // Pass printer settings object to the method
                viewer.PrintDocumentWithSettings(printerSetttings);
                viewer.Close();
                // ExEnd:PdfToPostScript
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }       
コード例 #6
0
        public static void Run()
        {
            try
            {
                // ExStart:PrintPageRange
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

                Aspose.Pdf.Facades.PdfViewer pdfv = new Aspose.Pdf.Facades.PdfViewer();

                pdfv.PdfQueryPageSettings += PdfvOnPdfQueryPageSettings;

                System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
                System.Drawing.Printing.PrinterSettings prin = new System.Drawing.Printing.PrinterSettings();

                pdfv.BindPdf(dataDir + "Print-PageRange.pdf");
                prin.PrinterName = "HP LaserJet M9050 MFP PCL6";
                prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

                Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor();
                pageEditor.BindPdf(dataDir + "input.pdf");

                pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
                pgs.PaperSize = prin.DefaultPageSettings.PaperSize;

                pdfv.PrintDocumentWithSettings(pgs, prin);
                pdfv.Close();
                // ExEnd:PrintPageRange
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }