Add Underline Annotations in PDF document via Java

Build your own Java apps to manipulate comments & authors in PDF files using native APIs.

Work with annotations using the Aspose.PDF for Java. Annotations are digital notes, comments, highlights, or other graphical elements that can be added to a PDF file to provide additional information or interact with the content. Add Underline annotations to PDF using the Aspose.PDF for Java. Adding annotations to a PDF file provides the usability and interactivity of the document, and improves presentations when using your document as a visual aid. Adding annotations to PDF can be used to create navigation tools, allowing users to access specific sections, websites, or external resources. Extracting annotations allows users to review comments, feedback, or notes made by others on the document, facilitating collaboration and discussion. The ability to get annotations from a document is necessary when working with large volumes of documents. The Aspose.PDF for Java library can get annotations from PDF in a few steps. Annotations may contain private information. Removing Underline annotations is necessary to ensure that such information is not unintentionally shared when sharing the PDF with others. Annotations may reveal data or information that needs to be protected for privacy reasons. Removing annotations helps safeguard data privacy. Annotations, especially excessive or outdated ones, can clutter a document and make it visually unappealing or harder to read. Removing Underline annotations can enhance the overall document’s readability. In order to annotate PDF file, we’ll use Aspose.PDF for Java API which is a feature-rich, powerful and easy to use conversion API for Java platform. You can download its latest version directly from Maven and install it within your Maven-based project by adding the following configurations to the pom.xml.

Repository

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java AP</name>
    <url>https://releases.aspose.com/java/repo/</url>
</repository>

Dependency

<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>version of aspose-pdf API</version>
</dependency>

Add Underline Annotation via Java


You need Aspose.PDF for Java to try the code in your environment.

  • Load PDF in an instance of Document class
  • Create a new page or get a reference to an existing one
  • Create Underline annotation
  • Call method Add for Underline annotation from Page.Annotations collections
  • Save the file again

System Requirements


Aspose.PDF for Java is supported on all major operating systems. Just make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with Java Runtime Environment for JSP/JSF Application and Desktop Applications.
  • Development environment like Eclipse or IntelliJ IDEA
  • Aspose.PDF for Java library referenced in your project.

Add Underline Annotations from PDF - Java

Example