I am currently modifying an existing system that generates reports with iText and java. The rep开发者_JAVA百科ort template is as follows:
Header1(PdfPTable)
Header2(PdfPTable) Body(PdfPTable)I am currently using the writeSelectedRows to display Header1 and Header2, but document.add is used to display the Body. The problem is that the system is setup to write the headers AFTER the body has already been displayed on the screen, so I am displaying my headers on top of my body content. My question is how do I add my body table (using document.add) and have it display about halfway down the page (or any predetermined vertical position)? This way I would have sufficient room to display my headers above the body table.
Note: I believe the body table is using document.add to facilitate automatic paging if the body content is too large.
Write your header tables to an absolute position at top of the document, so y position would be:
y = PageHeight - TableHeight;
Then add your body tables using document.add
here is an example i googled, Image in the Page Header Generated by iTextSharp?
精彩评论