Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Setiap halaman dalam file PDF memiliki sejumlah properti, seperti lebar, tinggi, bleed-, crop- dan trimbox. Aspose.PDF memungkinkan Anda untuk mengakses properti ini.
Potongan kode berikut juga bekerja dengan Aspose.PDF.Drawing library.
Potongan di bawah ini menunjukkan cara memotong halaman:
// 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");
}
}
Dalam contoh ini kami menggunakan file contoh di sini. Awalnya halaman kami terlihat seperti yang ditunjukkan pada Gambar 1.
Setelah perubahan, halaman akan terlihat seperti Gambar 2.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.