Set page margins with iTextSharp

Tyler Schroeder picture Tyler Schroeder · Feb 11, 2012 · Viewed 43.8k times · Source

I have a template PDF file that has a a PDF form field embedded in. I am using PdfStamper to fill out these fields. In addition, I would like to be able to change the margins for generated PDF. is there any way I can modify the page margins on the stamped PDF?

Answer

Baxter picture Baxter · Nov 7, 2013

You can do it all in one line.

Document doc = new Document(PageSize.LETTER, 0f, 0f, 0f, 0f );