Skip to main content
Skip table of contents

How to add blank pages to an existing PDF in java?

I have a normal PDF file, I want to insert blank pages at the end of this PDF using iText, without changing the existing PDF contents.

Posted on StackOverflow on May 24, 2013 by khAn

Please try this short code snippet:

PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
stamper.insertPage(reader.getNumberOfPages() + 1,

If src refers to a document with 10 pages, the code above will add an extra blank 11th page, using the same page size as the first page.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.