How to copy bookmarks from one PDF to another

32 sec read

How to copy bookmarks from one PDF to another

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");
final Document outlines = extract.getPDFTextOutline();

Then, write the Document object to the destination PDF:

// Write
final OutlineWriter writer = new OutlineWriter("destination.pdf", outlines);

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"

Learn more

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

How to debug PDF files

Jacob Collins
47 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2022. All rights reserved.