Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Каждая страница в PDF-файле имеет ряд свойств, таких как ширина, высота, область для обрезки и область для полей. Aspose.PDF позволяет получить доступ к этим свойствам.
Следующий фрагмент кода также работает с библиотекой Aspose.PDF.Drawing.
Приведённый ниже фрагмент показывает, как обрезать страницу:
// 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");
}
}
В этом примере мы использовали образец файла здесь. Изначально наша страница выглядит так, как показано на рисунке 1.
После изменения страница будет выглядеть как на рисунке 2.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.