Reputation: 425
I have a pdf document whose height i want to increase at top and bottom so that certain text can be written on it.
So is it possible to add padding at top and bottom of the page using PdfSharp or any other free library which in turn will increase page height also?
Thanks in advance
Ramesh
Upvotes: 2
Views: 785
Reputation: 425
I solved it as shown in following code snippet
// 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);
}
Upvotes: 1