Thanks for your reply. I found the getNumberofPages() method. I can explain a bit more on what I'm doing. I have say 3 pdf store as blobs on an Oracle database. I select the blobs from the database and put them on and array of type ByteArrayInputStream (inStreams).
I then call pdfEditor.concatenate(inStreams, outStream); to concatenate the pdfs. I then put the concatenated pdf back into the database. So I tried creating a PdfFileInfo class for each stream in the array and getting the number of pages. It does give me the correct number of pages. So far I haven't tried adding a page. However I find that when I now call pdfEditor.concatenate(inStreams, outStream); I'm getting an error "PDF header signature error".
Also if I create a new pdf can I just concatenate it onto the stream for the individual document before creating the concatenation of the 3 pdfs.
So my steps are.
1. Retrive the 3 documents from the database,
2. Check if an odd number of pages.
3. If odd number of pages add a blank page.
4 Join the 3 documents together and save back to the database.
This may seem a bit strange but the purpose is that we want to distribute one document printed on both sides of the page but we don't want the first page of the second..n documents to appear on the back of the last page of the previous document.