JPedal already has the ability to read bookmarks from PDF files so now you can chain this functionality with our OutlineWriter to copy bookmarks from one PDF to another.
Recently we released JPedal 2023.03 which includes the ability to write bookmarks (also known as the outline) to PDF files. You can download JPedal here to try for yourself.
Copy bookmarks using Java
First, read the outline into a Document object:
// Read final ExtractOutline extract = new ExtractOutline("source.pdf"); extract.openPDFFile(); final Document outlines = extract.getPDFTextOutline(); extract.closePDFfile();
Then, write the Document object to the destination PDF:
// Write final OutlineWriter writer = new OutlineWriter("destination.pdf", outlines); writer.writeOutline();
Copy bookmarks using the command line
JPedal also provides a convenient command line method to copy bookmarks between PDF files:
java -jar jpedal.jar --copyoutline "oldfile.pdf" "newfile.pdf"
More information is available on our support site.
Download JPedal here to get started.
Are you a Developer working with PDF files?
Our developers guide contains a large number of technical posts to help you understand the PDF file Format.
Do you need to solve any of these problems?
|Display PDF documents in a Web app|
|Use PDF Forms in a web browser|
|Convert PDF Documents to an image|
|Work with PDF Documents in Java|