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

This can be simplified to:

> for(PDPage page : doc.getPages()) {
>  addFooter(doc, page, regularFont, footerDetail)
> }

— John

> On 13 Oct 2015, at 07:24, Adam Retter <[email protected]> wrote:
> 
> On 13 October 2015 at 14:34, Maruan Sahyoun <[email protected]> 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
> http://www.adamretter.org.uk
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

Reply via email to