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: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: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:ZoomToPageContents // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Pages(); // Load source PDF file Document doc = new Document(dataDir + "input.pdf"); // Get rectangular region of first page of PDF Aspose.Pdf.Rectangle rect = doc.Pages[1].Rect; // Instantiate PdfPageEditor instance PdfPageEditor ppe = new PdfPageEditor(); // Bind source PDF ppe.BindPdf(dataDir + "input.pdf"); // Set zoom coefficient ppe.Zoom = (float)(rect.Width / rect.Height); // Update page size ppe.PageSize = new Aspose.Pdf.PageSize((float)rect.Height, (float)rect.Width); dataDir = dataDir + "ZoomToPageContents_out_.pdf"; // Save output file doc.Save(dataDir); // ExEnd:ZoomToPageContents System.Console.WriteLine("\nZoom to page contents applied successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:ZoomToPageContents // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Pages(); // Load source PDF file Document doc = new Document(dataDir + "input.pdf"); // Get rectangular region of first page of PDF Aspose.Pdf.Rectangle rect = doc.Pages[1].Rect; // Instantiate PdfPageEditor instance PdfPageEditor ppe = new PdfPageEditor(); // Bind source PDF ppe.BindPdf(dataDir + "input.pdf"); // Set zoom coefficient ppe.Zoom = (float)(rect.Width / rect.Height); // Update page size ppe.PageSize = new Aspose.Pdf.PageSize((float)rect.Height, (float)rect.Width); dataDir = dataDir + "ZoomToPageContents_out.pdf"; // Save output file doc.Save(dataDir); // ExEnd:ZoomToPageContents System.Console.WriteLine("\nZoom to page contents applied successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:GetPageProperties // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages(); // Open document PdfPageEditor pageEditor = new PdfPageEditor(); pageEditor.BindPdf(dataDir + "input.pdf"); // Get page properties Console.WriteLine(pageEditor.GetPageRotation(1)); Console.WriteLine(pageEditor.GetPages()); Console.WriteLine(pageEditor.GetPageBoxSize(1, "trim")); Console.WriteLine(pageEditor.GetPageBoxSize(1, "art")); Console.WriteLine(pageEditor.GetPageBoxSize(1, "bleed")); Console.WriteLine(pageEditor.GetPageBoxSize(1, "crop")); Console.WriteLine(pageEditor.GetPageBoxSize(1, "media")); // ExEnd:GetPageProperties }