How do you insert a new page in a PDF document at a particular (page) 
location?

I see the question was asked before, but I saw no answer.

Thanks, Alan 

      Subject: Insert a newpage in a PDF Actions... 
      From: Hesham G. (onli...@gawab.com) 
      Date: Apr 23, 2009 10:36:15 pm 
      List: org.apache.incubator.pdfbox-dev 


Hello, 

I've been facing a problem with PDFBox and i hopped you can help me. It's about 
adding a newpage to a PDF file after a specific page, Say the PDF is
200 pages and i wanted to create a newpage then save it after page 100. I found 
that if the PDF was already created using PDFBox, then i can do it as in
the code down here, but if the PDF was not created using PDFBox, then the page
will be added after the end of the PDF only. 

[code] PDDocument doc = PDDocument.load( file ); // Open this pdf to edit. 
PDPage page = new PDPage(); PDPageNode rootPages = 
doc.getDocumentCatalog().getPages(); rootPages.getKids().add(100, page ); 
//Write some text page.setParent( rootPages ); rootPages.updateCount(); 
doc.save( file ); doc.close(); [/code] 

I really hope you can help me with that. Any ideas ? 

Best regards, 

Reply via email to