Esempio n. 1
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);
            }
        }
Esempio n. 2
0
 public static void Main()
 {
     // The path to the documents directory.
     string dataDir = Path.GetFullPath("../../../Data/");
     // instantiate PdfPageEditor class to get particular page region
     Aspose.Pdf.Facades.PdfPageEditor editor = new Aspose.Pdf.Facades.PdfPageEditor();
     // bind the source PDF file
     editor.BindPdf(dataDir + "SampleInput.pdf");
     // move the origin of PDF file to particular point
     editor.MovePosition(0, 700);
     // create a memory stream object
     MemoryStream ms = new MemoryStream();
     // save the updated document to stream object
     editor.Save(ms);
     //create PdfConverter object
     PdfConverter objConverter = new PdfConverter();
     //bind input pdf file
     objConverter.BindPdf(ms);
     //set StartPage and EndPage properties to the page number to
     //you want to convert images from
     objConverter.StartPage = 1;
     objConverter.EndPage = 1;
     //Counter
     int page = 1;
     //initialize the converting process
     objConverter.DoConvert();
     //check if pages exist and then convert to image one by one
     while (objConverter.HasNextImage())
         objConverter.GetNextImage(dataDir+ "Specific_Region-Image" + page++ + ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
     //close the PdfConverter object
     objConverter.Close();
     // close MemoryStream object holding the updated document
     ms.Close();
 }
Esempio n. 3
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();
        }
        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();
        }
        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);
            }
        }
Esempio n. 6
0
        public static void Run()
        {
            // ExStart:EditPdfPages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Create a new instance of PdfPageEditor class
            Aspose.Pdf.Facades.PdfPageEditor pEditor = new Aspose.Pdf.Facades.PdfPageEditor();
            // Bind an existing pdf file
            pEditor.BindPdf(dataDir + "FilledForm.pdf");
            // Specify an array of pages which need to be manipulated pages can be multiple, here we have specified only one page
            pEditor.ProcessPages = new int[] { 1 };

            //alignment related code

            // Horizontal alignment
            pEditor.HorizontalAlignment = HorizontalAlignment.Right;

            // Specify transition type for the pages
            pEditor.TransitionType = 2;
            //specify transition duration
            pEditor.TransitionDuration = 5;

            // Display related code

            // Select a page size from the enumeration and assign to property
            pEditor.PageSize = PageSize.PageLedger;
            // Assign page rotation
            pEditor.Rotation = 90;
            // Specify zoom factor for the page
            pEditor.Zoom = 100;
            // Assign display duration for the page
            pEditor.DisplayDuration = 5;

            // Methods provided by the class page rotation specified already can be fetched using this method
            int rotation = pEditor.GetPageRotation(1);
            // Already specified page can be fetched with the help of this method
            PageSize pagesize = pEditor.GetPageSize(1);
            // This method gets the page count
            int totalpages = pEditor.GetPages();

            // This method changes the origin from (0,0) to specified number
            pEditor.MovePosition(100, 100);

            // Finally save the output file
            pEditor.Save(dataDir + "EditPdfPages_out_.pdf");
            // ExEnd:EditPdfPages
        }
        public static void Run()
        {
            // ExStart:EditPdfPages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();
     
            // Create a new instance of PdfPageEditor class
            Aspose.Pdf.Facades.PdfPageEditor pEditor = new Aspose.Pdf.Facades.PdfPageEditor();
            // Bind an existing pdf file
            pEditor.BindPdf(dataDir + "FilledForm.pdf");
            // Specify an array of pages which need to be manipulated pages can be multiple, here we have specified only one page
            pEditor.ProcessPages = new int[] { 1 };

            // Alignment related code

            // Horizontal alignment
            pEditor.HorizontalAlignment = HorizontalAlignment.Right;      

            // Specify transition type for the pages
            pEditor.TransitionType = 2;
            // Specify transition duration
            pEditor.TransitionDuration = 5;

            // Display related code

            // Select a page size from the enumeration and assign to property
            pEditor.PageSize = PageSize.PageLedger;
            // Assign page rotation
            pEditor.Rotation = 90;
            // Specify zoom factor for the page
            pEditor.Zoom = 100;
            // Assign display duration for the page
            pEditor.DisplayDuration = 5;

            // Methods provided by the class page rotation specified already can be fetched using this method
            int rotation = pEditor.GetPageRotation(1);
            // Already specified page can be fetched with the help of this method
            PageSize pagesize = pEditor.GetPageSize(1);
            // This method gets the page count
            int totalpages = pEditor.GetPages();
            // This method changes the origin from (0,0) to specified number
            pEditor.MovePosition(100, 100);

            // Finally save the output file
            pEditor.Save(dataDir + "EditPdfPages_out.pdf");
            // ExEnd:EditPdfPages                      
        }
Esempio n. 8
0
        public static void Run()
        {
            // ExStart:ConvertPageRegion
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Images();

            // Instantiate PdfPageEditor class to get particular page region
            Aspose.Pdf.Facades.PdfPageEditor editor = new Aspose.Pdf.Facades.PdfPageEditor();
            // Bind the source PDF file
            editor.BindPdf(dataDir + "Convert-PageRegion.pdf");
            // Move the origin of PDF file to particular point
            editor.MovePosition(0, 700);
            // Create a memory stream object
            MemoryStream ms = new MemoryStream();

            // Save the updated document to stream object
            editor.Save(ms);
            // Create PdfConverter object
            PdfConverter objConverter = new PdfConverter();

            // Bind input pdf file
            objConverter.BindPdf(ms);
            // Set StartPage and EndPage properties to the page number to
            // You want to convert images from
            objConverter.StartPage = 1;
            objConverter.EndPage   = 1;
            // Counter
            int page = 1;

            // Initialize the converting process
            objConverter.DoConvert();
            // Check if pages exist and then convert to image one by one
            while (objConverter.HasNextImage())
            {
                objConverter.GetNextImage(dataDir + "Specific_Region-Image" + page++ + "_out_.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
            }
            // Close the PdfConverter object
            objConverter.Close();
            // Close MemoryStream object holding the updated document
            ms.Close();
            // ExEnd:ConvertPageRegion
        }
Esempio n. 9
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            // instantiate PdfPageEditor class to get particular page region
            Aspose.Pdf.Facades.PdfPageEditor editor = new Aspose.Pdf.Facades.PdfPageEditor();
            // bind the source PDF file
            editor.BindPdf(dataDir + "SampleInput.pdf");
            // move the origin of PDF file to particular point
            editor.MovePosition(0, 700);
            // create a memory stream object
            MemoryStream ms = new MemoryStream();

            // save the updated document to stream object
            editor.Save(ms);
            //create PdfConverter object
            PdfConverter objConverter = new PdfConverter();

            //bind input pdf file
            objConverter.BindPdf(ms);
            //set StartPage and EndPage properties to the page number to
            //you want to convert images from
            objConverter.StartPage = 1;
            objConverter.EndPage   = 1;
            //Counter
            int page = 1;

            //initialize the converting process
            objConverter.DoConvert();
            //check if pages exist and then convert to image one by one
            while (objConverter.HasNextImage())
            {
                objConverter.GetNextImage(dataDir + "Specific_Region-Image" + page++ + ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
            }
            //close the PdfConverter object
            objConverter.Close();
            // close MemoryStream object holding the updated document
            ms.Close();
        }