Java [pdf](https://kb.fileformat.app/extension/pdf-file-info/) developers can easily add a strike‑through annotation to any PDF document using the Aspose.PDF Cloud REST API. This guide walks you through the required setup, the exact steps to create and apply a StrikeOutAnnotation, and how to retrieve the updated file—all with the Java SDK.
Prerequisite
- Download the Aspose.PDF Cloud SDK for Java
- Configure your Java project with the SDK to enable strike‑through operations
Steps to strike out text in a PDF with Java REST Interface
- Initialise the PdfApi object with your API key and Application SID.
- Create a StrikeOutAnnotation instance and define the rectangle that surrounds the target text, as well as the annotation colour.
- Set the creation and modification dates for the annotation (required fields).
- Upload the source PDF file to Aspose Cloud storage.
- Invoke the postPageStrikeOutAnnotations method to apply the strike‑out annotation with your custom settings.
- Download the resulting PDF that now contains the strike‑through text.
These steps illustrate how to programmatically add a strike‑through to PDF content using the Java REST API. By configuring the PdfApi and StrikeOutAnnotation objects, uploading the document, and calling postPageStrikeOutAnnotations, you achieve the desired annotation effect.
Code to strike through text in PDF with Java‑based API
The snippet above demonstrates how to set properties such as page index, Z‑index, alignment, name, subject, and title for each StrikeOutAnnotation. You can add multiple annotations to the list and then call postPageStrikeOutAnnotations to apply them all at once.
For related operations, see the article on Replace text in PDF with Java REST API.
Keywords: how to strike out text in pdf with Java REST API; how to strike through text in pdf with Java Low Code API; how to strikeout in pdf with Java REST Interface; strike out in adobe pdf with Java REST Interface; strike out text in pdf with Java RESTful Service; strike through in pdf with Java-based API; strike through text in pdf with Java REST API; strike through text on pdf with Java Low Code API.