// Open the document
PdfDocument inputDocument = PdfReader.Open(@"D:\test.pdf", PdfDocumentOpenMode.Modify);
// Iterate pages
foreach (PdfPage page in inputDocument.Pages)
{
// Add height at top of the page
page.Height += 100;
// Add height at bottom of the page
XRect rect= new XRect(0, -100, page.Width, page.Height + 100);
page.MediaBox = new PdfRectangle(rect);
}
1 回答
我解决了它,如下面的代码片段所示