I'm using ItextSharp to populate a Pdf template with data. The template is a single page form with a number of input fields. I can create a PdfStamper and populate the fields with no problem, however, I want to开发者_高级运维 add a second page to the stamper and then add a dynamically created PdfPtable to that page. I can add a page using stamper.InsertPage(2,reader.GetpageSize()) but I can not work out how to add the table to the page.
Any help would be much appreciated.
Get your new page's PdfContentByte
, then use PdfPTable.WriteSelectedRows()
. There are 4 different overrides providing you with various options.
WriteSelectedRows
just takes row [& column] numbers to draw, an X/Y location, and a PdfContentByte
or array of same. This means it won't do any page breaking or width validation or what have you. It'll just draw what you ask it to draw, where you ask it to draw it. You have to do all the layout yourself.
精彩评论