添加页脚所有页面文档

Add footer all page document

我正在 Java 中创建 pdf。我想将相同的文本添加到 PDF 的所有页面。我做不到,因为页数不是恒定的。你能帮忙吗?

import com.lowagie.text.Document;

ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase("MEPSAN PETROL CİHAZLARI SAN. TİC. A.Ş.", new Font(bf, 6, Font.BOLD)), 100, 30, 0);

以上代码只添加到当前页面。 我该如何改进它?

您可以使用 com.lowagie.text 包中的 HeaderFooter class。

这里有一个工作代码示例供参考:

https://www.programcreek.com/java-api-examples/index.php?api=com.lowagie.text.HeaderFooter

这是 HeaderFooter 的文档 class:

http://www.docjar.com/docs/api/com/lowagie/text/HeaderFooter.html

您需要进一步评论或收件箱assistance/clarification。