Alex Rivera | Logout

Set page margins with iTextSharp

Asked 2012-02-11T01:12:24.130
21

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?

Edit
Report

1 Answer

16

Only way I know of is like this.

iTextSharp.text.Rectangle rec = new iTextSharp.text.Rectangle(pageWidth, pageHeight); 
Document doc = new Document(rec); 
doc.SetMargins(0f, 0f, 0f, 0f);

However, this will limit margins too

answered 2012-02-16T20:01:33.980

Your Answer