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.