Jacob Collins Jacob is the JPedal Product Lead and specialises in PDF creation and manipulation. He also develops Salesforce backend systems and contributes to marketing and support. Outside work, he’s a 1900‑rated chess player, guitarist, and French learner.

How to extract embedded files from a PDF in Java (Tutorial)

43 sec read

extract embedded files

PDF files sometimes reference external resources such as images or other documents. To increase portability and ease archival of such PDF files, these resources can be embedded within the PDF itself. These are known as attachments or embedded files.
 
If you wish to extract these embedded files from a PDF using Java, you will need to use a third-party library since Java does not have built-in support for processing PDF files.
 
This tutorial uses JPedal.
 

How to extract embedded files from a PDF file programmatically

  1. Add JPedal to your class or module path (download the trial jar)
  2. Run the following Java code:

 

How to extract embedded files from a PDF file using the commandline

  1. Add JPedal to your class or module path (download the trial jar)
  2. Run the following command:

  3.  
    You can expand your understanding of the PDF format by reading our other articles. Similarly, if there is a specific term for PDF you would like to know more about, our PDF Glossary has an extensive list of common terms.


The JPedal PDF library allows you to solve these problems in Java


Jacob Collins Jacob is the JPedal Product Lead and specialises in PDF creation and manipulation. He also develops Salesforce backend systems and contributes to marketing and support. Outside work, he’s a 1900‑rated chess player, guitarist, and French learner.

Easily convert PDF to HTML in Java (Tutorial)

PDF to HTML conversion helps improve your PDF content for browser display. BuildVu is one of the leading PDF to HTML solution for developers....
Leon Atherton
1 min read