Based on your comments, I assume that you are using PdfStamper
and that you're able to add an image to an existing page. This is, for instance, done using getUnderContent()
and its addImage()
method. Now you need to add an extra page.
In PdfStamper
, you can use the insertPage()
method to achieve this:
stamper.insertPage(pageNum, rectangle);
In this line pageNum
is an int value indication the page number where you want to insert the new page, and rectangle
is the size of the page. For instance:
stamper.insertPage(reader.getNumberOfPages() + 1, reader.getPageSize(1));
Once you have inserted the page, you can get the "over" or "under" content, and add an image to that PdfContentByte
using the addImage()
method. You might want to replace reader.getPageSize(1)
with a Rectangle
object that corresponds with the dimensions of the image.