示例#1
0
        public static void Run()
        {
            // ExStart:PageRotation
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Create PdfPageEditor object
            PdfPageEditor pEdit = new PdfPageEditor();

            // Rotate odd pages at 180 degrees
            pEdit.BindPdf(dataDir + "inFile1.pdf");
            pEdit.ProcessPages = new int[] { 1 };
            pEdit.Rotation     = 180;
            pEdit.Save(dataDir + "Aspose.Pdf.Facades_rotate_180_out.pdf");

            // Rotate even pages at 270 degrees
            pEdit.BindPdf(dataDir + "inFile2.pdf");
            pEdit.ProcessPages = new int[] { 1 };
            pEdit.Rotation     = 270;
            pEdit.Save(dataDir + "Aspose.Pdf.Facades_rotate_270_out.pdf");

            // Find at what degrees a page was rotated
            pEdit.BindPdf(dataDir + "inFile.pdf");
            int degrees = pEdit.GetPageRotation(1);

            pEdit = null;
            // ExEnd:PageRotation
        }
        public static void Run()
        {
            // ExStart:PageRotation
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Create PdfPageEditor object
            PdfPageEditor pEdit = new PdfPageEditor();

            // Rotate odd pages at 180 degrees
            pEdit.BindPdf(dataDir + "inFile1.pdf");
            pEdit.ProcessPages = new int[] { 1 };
            pEdit.Rotation = 180;
            pEdit.Save(dataDir + "Aspose.Pdf.Facades_rotate_180_out.pdf");

            // Rotate even pages at 270 degrees
            pEdit.BindPdf(dataDir + "inFile2.pdf");
            pEdit.ProcessPages = new int[] { 1 };
            pEdit.Rotation = 270;
            pEdit.Save(dataDir + "Aspose.Pdf.Facades_rotate_270_out.pdf");

            // Find at what degrees a page was rotated
            pEdit.BindPdf(dataDir + "inFile.pdf");
            int degrees = pEdit.GetPageRotation(1);
            pEdit = null;
            // ExEnd:PageRotation                      
        }
        public static void Run()
        {
            // ExStart:SetPageProperties
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages();

            // Open document
            PdfPageEditor pageEditor = new PdfPageEditor();
            pageEditor.BindPdf(dataDir + "input.pdf");

            // Set page properties
            // Move origin from (0,0)
            pageEditor.MovePosition(100, 100);
            // Set page rotations
            Hashtable pageRotations = new Hashtable();
            pageRotations.Add(1, 90);
            pageRotations.Add(2, 180);
            pageRotations.Add(3, 270);
            // PageEditor.PageRotations = pageRotations;
            // Set zoom where 1.0f = 100% zoom
            pageEditor.Zoom = 2.0f;
            // Save updated PDF file
            pageEditor.Save(dataDir + "SetPageProperties_out.pdf");
            // ExEnd:SetPageProperties
        }
        public static void Run()
        {
            // ExStart:ChangePageSizes
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Create PdfPageEditor object
            PdfPageEditor pEdit = new PdfPageEditor();

            // Bind pdf file
            pEdit.BindPdf(dataDir + "FilledForm.pdf");

            // Change page size of the selected pages
            pEdit.ProcessPages = new int[] { 1 };

            // Here we select a member named 'LETTER' from the list of members of PageSize class and assign it to PageSize property of the PdfPageEditor class
            pEdit.PageSize = PageSize.PageLetter;

            // Save the file
            pEdit.Save(dataDir + "ChangePageSizes_out_.pdf");

            // Find at what size a page has been assigned
            pEdit.BindPdf(dataDir + "FilledForm.pdf");
            PageSize size = pEdit.GetPageSize(1);

            pEdit = null;
            // ExEnd:ChangePageSizes
        }
        public static void Run()
        {
            // ExStart:SetPageProperties
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages();

            // Open document
            PdfPageEditor pageEditor = new PdfPageEditor();

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

            // Set page properties
            // Move origin from (0,0)
            pageEditor.MovePosition(100, 100);
            // Set page rotations
            Hashtable pageRotations = new Hashtable();

            pageRotations.Add(1, 90);
            pageRotations.Add(2, 180);
            pageRotations.Add(3, 270);
            // PageEditor.PageRotations = pageRotations;
            // Set zoom where 1.0f = 100% zoom
            pageEditor.Zoom = 2.0f;
            // Save updated PDF file
            pageEditor.Save(dataDir + "SetPageProperties_out.pdf");
            // ExEnd:SetPageProperties
        }
        public static void Run()
        {
            // ExStart:ChangePageSizes
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Create PdfPageEditor object
            PdfPageEditor pEdit = new PdfPageEditor();

            // Bind pdf file
            pEdit.BindPdf(dataDir + "FilledForm.pdf");

            // Change page size of the selected pages
            pEdit.ProcessPages = new int[] { 1};

            // Here we select a member named 'LETTER' from the list of members of PageSize class and assign it to PageSize property of the PdfPageEditor class
            pEdit.PageSize = PageSize.PageLetter;

            // Save the file
            pEdit.Save(dataDir + "ChangePageSizes_out.pdf");

            // Find at what size a page has been assigned
            pEdit.BindPdf(dataDir + "FilledForm.pdf");
            PageSize size = pEdit.GetPageSize(1);
            pEdit = null;
            // ExEnd:ChangePageSizes                      
        }