iText - add content to the bottom of an existing page

后端 未结 3 1064
Happy的楠姐
Happy的楠姐 2021-01-27 09:28

I want to add a piece of text to every page of a PDF file. This answer in SO works fine. But, the text is added to the top of the page. I would like to add my text to the bottom

3条回答
  •  盖世英雄少女心
    2021-01-27 09:53

    Have a look at chapter 6 of iText in Action, 2nd edition, especially at subsection 6.4.1: Concatenating and splitting PDF documents.

    Listing 6.22, ConcatenateStamp.java, shows you how you should create a PDF from copies of pages (in your case: all pages) of multiple other PDFs; the sample additionally adds a new "Page X of Y" footer; this demonstrates how you can add content at given positions on the pages while merging the source files.

提交回复
热议问题