If you don't mind losing all interactivity that might be present in the existing PDF, you can use PdfReader
and PdfImportedPage
. Please start by reading the documentation, more specifically section 6.2.1 entitled "Importing pages". You can also download the example ImportingPages1 or take a look at this code snippet:
PdfReader reader = new PdfReader(existing_pdf);
PdfImportedPage page = writer.getImportedPage(reader, pagenumber);
document.setPageSize(reader.getPageSize(pagenumber));
document.newPage();
PdfContentByte canvas = writer.getDirectContent();
canvas.addTemplate(page, 0, 0);
This snippet is written from memory. You may need to tweak it here and there if it doesn't work immediately.