pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Retter <adam.ret...@googlemail.com>
Subject Re: Insert Cover Page (2.0.0)
Date Tue, 13 Oct 2015 14:24:30 GMT
On 13 October 2015 at 14:34, Maruan Sahyoun <sahyoun@fileaffairs.de> wrote:
> Hi,
> glad it worked. I would be interested in how you add the footer to the page i.e. how
do you do the iteration, how do you add the additional content. It's always good for us to
get a better understanding of how PDFBox is actually used.

Once I have opened my document, set some metadata and inserted my
cover page, then I basically have something similar to this:

Iterator<PDPage> iterator = doc.getPages.iterator()
while(iterator.hasNext()) {
  PDPage page = iterator.next();
  addFooter(doc, page, regularFont, footerDetail)

private void addFooter(PDDocument doc, PDPage page, PDFont
regularFont, FooterDetail footerDetail) {
  try(final PDPageContentStream contentStream = new
PDPageContentStream(doc, page, true, true, true)) {
    //various positioning, and calls to beginText, setFont, showText, endText

Adam Retter

skype: adam.retter
tweet: adamretter

To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

View raw message