Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
PdfPageEditor class in Aspose.Pdf.Facades namespace contains a property named PageSize which can be used to change the page size of an individual page or multiple pages at once. The Pages property can be used to assign the numbers of the pages on which the new page size needs to be applied. PageSize class contains a list of different page sizes as its members. Any of the members of this class can be assigned to PageSize property of the PdfPageEditor class. You can also get page size of any page using GetPageSize method and passing the page number.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ChangePdfPageSize()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create PdfPageEditor object
using (var pdfPageEditor = new Aspose.Pdf.Facades.PdfPageEditor())
{
// Bind PDF document
pdfPageEditor.BindPdf(dataDir + "FilledForm.pdf");
// Change page size of the selected pages
pdfPageEditor.ProcessPages = new[] { 1 };
// Select a predefined page size (LETTER) and assign it
pdfPageEditor.PageSize = Aspose.Pdf.PageSize.PageLetter;
// Save the file with the updated page size
pdfPageEditor.Save(dataDir + "ChangePageSizes_out.pdf");
// Get and display the page size assigned
pdfPageEditor.BindPdf(dataDir + "FilledForm.pdf");
var pageSize = pdfPageEditor.GetPageSize(1);
Console.WriteLine($"Width: {pageSize.Width}, Height: {pageSize.Height}");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.