In this guide, we will cover how to change PDF metadata using Java. It has information about setting up the development environment, a list of tasks required for the development of the application, and a runnable sample code to edit metadata of PDF using Java. Different options will be discussed to work with the metadata like adding properties and clearing the properties.
Steps to Change PDF Properties using Java
- Set the IDE to use Aspose.PDF for Java to modify metadata
- Load the source PDF file into the document object for editing the properties
- Populate the DocumentInfo object by linking it with the loaded PDF file
- Update the desired properties for example modification date, subject, title, etc.
- Save the output PDF file with new metadata
This guide breaks down the process to change metadata of PDF using Java. The process is commenced by loading the source PDF file followed by populating the DocumentInfo from the loaded PDF file. This object contains all the properties that can be modified by accessing each property one by one.
Code to Modify PDF Metadata using Java
The above implementation showcases the process to develop PDF metadata editor using Java. The DocumentInfo class contains features to modify, and delete all properties at once or one by one, and testing if a particular property is predefined or custom one. You can access the target properties using the name or index you chose.
From reading this article, we now understand the concept of PDF meta editor using Java. If you want to learn the process to add a watermark, refer to the article on how to add watermark to PDF using Java.