Here is a sample java program showing how to merge all the PDF files contained in a folder as a new merged PDF document and save it to a new file. This program uses Qoppa’s library jPDFProcess. It can easily be adapted to use jPDFAssemble as well. // create a new PDF document PDFDocument mergePDF […]
Category: jPDFAssemble: Merge PDFs, Split PDFs
Java PDF library to assemble, merge, split PDF documents.
Setting / Editing PDF Document Properties & Metadata including Title, Subject, Author, Keywords
After creating or assembling a PDF document, it is a important to set or edit the meta data. Qoppa Java libraries jPDFAssemble and jPDFProcess can edit document properties and xml metadata such as title, author, subject and keywords. The sample java code below shows how to open a PDF, edit the document properties and then […]
Deleting all bookmarks from a PDF document
To delete all bookmarks in a PDF document, simply create a new empty root bookmark. With jPDFProcess, use PDFDocument.createRootBookmark(); With jPDFAssemble, use PDFAssemble.createRootBookmark(); With jPDFEditor, use PDFEditorBean.getDocument().createRootBookmark(); Here is sample code to do so: // Load the document PDFDocument pdfDoc = new PDFDocument ("input.pdf", null); // Get the root bookmark, create one if necessary Bookmark […]
Copying pages from one PDF to another PDF in Java
Here is a sample Java program that shows how to copy pages from one PDF document to another using Qoppa’s PDF library jPDFProcess. The sample can be adapted to work with Qoppa’s jPDFAssemble by simply replacing the class “PDFDocument” with “PDFAssemble”. In this sample, we’re copying the pages from an existing PDF to a new […]
jPDFAssemble java API
Q: Where can I find jPDFAssemble javadoc API? A: You can find the API specification for the latest version of our library jPDFAssemble on our website at this link. jPDFAssemble is a java library to merge, split and assemble PDF documents in Java.
Code Sample: Split a PDF document in 2 in Java
This Java program splits one PDF document into two PDF files using Qoppa’s library jPDFAssemble: a first PDF document (“split1”) which contains the first and second page and a second PDF document (“split2”) which contains the third and fourth page of the original PDF. // Load the original PDF document PDFAssemble pdfDoc1 = new PDFAssemble […]
Code Sample: Merge 2 PDF files into one in Java using jPDFAssemble
This Java program merges two PDF files into a single one using Qoppa’s library jPDFAssemble. It is doing so by first opening the 2 PDFs and then appending the second one to the first one and saving the resulting document. // Load the two PDF documents PDFAssemble pdfDoc1 = new PDFAssemble ("doc1.pdf", null); PDFAssemble pdfDoc2 = […]
Code Sample: Add PDF Bookmarks
Working with Bookmarks jPDFAssemble and jPDFProcess allow to create new bookmarks or manipulate existing bookmarks in PDF documents. Here is an example on how to add bookmarks for each page of a PDF document: // Get current bookmark root Bookmark rootBK = pdfDoc.getRootBookmark(); // Create a root bookmark if it’s null if(rootBK == null) { rootBK = […]