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(); }
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 }
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 }
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(); }