add header to pdf using iText

后端 未结 2 1749
囚心锁ツ
囚心锁ツ 2021-01-19 11:10

how i can add header to each PDF page using iText 5.0.5.

相关标签:
2条回答
  • 2021-01-19 11:48

    See the below link having video to show you.

    http://itextpdf.com/book/chapter.php?id=4

    For Header-Footer: http://kuujinbo.info/cs/itext.aspx

    http://www.codeproject.com/KB/graphics/ITextSharpHelperClass.aspx

    Please Vote if this helps to you.

    0 讨论(0)
  • 2021-01-19 11:52

    This is covered in chapter 5 of iText In Action, 2nd ed. The code examples are all freely available online. In particular MovieCountries1 and MovieHistory2 both deal with page headers and footers.

    It boils down to using a PdfPageEvent implementation (usually derived from PdfPageEventHelper to cut down on boilerplate) to draw into the page's Direct Content during an EndPage (or BeginPage I suppose) event.

    You have to know where you want them, and you have to draw using a PdfContentByte instance, so you can't use the high-level Paragraph/Chapter/Chunk/Image/etc classes. You have to draw-this-there, draw-that-here. ColumnText can help a bit... but only for Plain Text. Anything even remotely fancy and you're on your own.

    0 讨论(0)
提交回复
热议问题