aspose file tools*
The moose likes Other Open Source Projects and the fly likes Inserting a PDF document into a new PDF Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Inserting a PDF document into a new PDF Page" Watch "Inserting a PDF document into a new PDF Page" New topic
Author

Inserting a PDF document into a new PDF Page

Fred Khadour
Greenhorn

Joined: May 10, 2013
Posts: 2
I am working on a project to insert PDF document in the middle of a PDF page built in Java (using iText Library). I am able to do that but my problem is that everytime it put the PDF document at the first page, at the top. I can not insert it where ever I want. I appreciate any help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41489
    
  53
The PDFBox library can chop a PDF into individual PDFs containing one page each. It also can assemble a new PDF from single-page PDFs. Those two functionalities combined should let you achieve what you're asking. For high-level manipulations like this I find PDFBox easier to use than iText.


Ping & DNS - my free Android networking tools app
Fred Khadour
Greenhorn

Joined: May 10, 2013
Posts: 2
Ulf Dittmer, Thank you for your help. In fact, I did what you said by using PDFBox library. I read PDF into PDDocument then into PDF pages. Each page is converted to BufferedImage then into Image so I can set the image inside PdfCell of iText (I have to build my PDF document with iText because I have other stuff to add to the page.) Anyway, it looks working fine. I am able to insert PDF images anywhere inside my new PDF document. However, it add extra empty page after each PDF image!!! Any clue how to fix that, thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inserting a PDF document into a new PDF Page