Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Each page in a PDF file has a number of properties, such as the width, height, bleed-, crop- and trimbox. Aspose.PDF allows you to access these properties.
The following code snippet also work with Aspose.PDF.Drawing library.
The snippet below show how to crop the page:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void CropPage()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Pages();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "CropPageInput.pdf"))
{
Console.WriteLine(document.Pages[1].CropBox);
Console.WriteLine(document.Pages[1].TrimBox);
Console.WriteLine(document.Pages[1].ArtBox);
Console.WriteLine(document.Pages[1].BleedBox);
Console.WriteLine(document.Pages[1].MediaBox);
// Create new Box rectangle
var newBox = new Rectangle(200, 220, 2170, 1520);
document.Pages[1].CropBox = newBox;
document.Pages[1].TrimBox = newBox;
document.Pages[1].ArtBox = newBox;
document.Pages[1].BleedBox = newBox;
// Save PDF document
document.Save(dataDir + "CropPage_out.pdf");
}
}
In this example we used a sample file here. Initially our page looks like shown on the Figure 1.
After the change, the page will look like Figure 2.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.