GroupDocs.Watermark for Java API

Polish Your RTF Documents: Watermark Editing

Refine your documents with our comprehensive watermark editing capabilities. Polish your content with precision.

Adjust Rtf document watermarks using Java

GroupDocs.Watermark for Java allows Java developers to easily adjust watermarks in many documents using their applications. Here’s a quick guide:

  1. Firstly, you need to pass Rtf file as parameter of the Watermarker class constructor. Provide byte or file stream or a local disk path.
  2. Secondly, locate the watermarks that need to be adjusted. Use SearchCriteria to identify watermarks with the specific properties previously added to the document.
  3. Following the search, you’ll receive a list of relevant watermarks. You can then adjust their properties, including size, page alignment, text, color, image content, and more. This offers a high degree of customization for your data.
  4. Once you’ve finished adjusting the watermarks, save the updated document. You can use a local file path, or stream to store the result.
// Adjust RTF image watermark

// Instantiate Watermarker with RTF
Watermarker watermarker = new Watermarker("input.rtf");

// Initialize the SearchCriteria to match a particular image
SearchCriteria searchCriteria = new ImageDctHashSearchCriteria("logo.png");
PossibleWatermarkCollection watermarks = watermarker.search(searchCriteria);

for (PossibleWatermark watermark : watermarks)
{
    // Replace image which was found
    watermark.setImageData(imageData);
}

// Save adjusted file
watermarker.save("output.rtf");
<dependencies> <dependency> <groupId>com.groupdocs</groupId> <artifactId>groupdocs-watermark</artifactId> <version>24.8</version> </dependency> </dependencies> <repositories> <repository> <id>repository.groupdocs.com</id> <name>GroupDocs Repository</name> <url>https://repository.groupdocs.com/repo/</url> </repository> </repositories>
click to copy
copied
More examples Documentation

Advanced RTF Watermark Management for Java Applications

The GroupDocs.Watermark API empowers developers to seamlessly integrate watermarking functionality into their Java applications. It supports adding, editing, removing, and searching for watermarks across a wide range of document formats.

Watermark Adjustment

Effortless Watermark Integration

GroupDocs.Watermark simplifies the process of adding diverse watermarks to various business documents and files within Java applications. Developers can not only apply watermarks, but also update or remove existing ones programmatically.

Granular Watermark Customization

The API provides extensive customization options for watermarks. Developers can easily adjust size, rotation, color, font, styles, and other properties to achieve the desired visual effect.

Leveraging RTF Native Document Features

Depending on the target document format, developers can utilize native functionalities for watermark placement. These functionalities might include document page background, annotations, headers, or other objects as watermark containers.

Adjust image watermark in Spreadsheets

This examples shows how to adjust the image of the particular shapes in an Excel Worksheet.

Java


//  Load document as Spreadsheet
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions();
Watermarker watermarker = new Watermarker("source.xlsx", loadOptions);

//  Get new watermark bytes
File file = new File("new_watermark.png");
byte[] imageBytes = new byte[(int) file.length()];
FileInputStream inputStream = new FileInputStream(file);
inputStream.read(imageBytes);
inputStream.close();

//  Adjust content of particular watermark
for (SpreadsheetShape shape : content.getWorksheets().get_Item(0).getShapes())
{
    if (shape.getImage() != null)
    {
        shape.setImage(new SpreadsheetWatermarkableImage(imageBytes));
    }
}

//  Save result document
watermarker.save("result.xlsx");
watermarker.close();

GroupDocs.Watermark for Java API

Polish Your Documents: Our comprehensive watermark editing capabilities allow you to refine your documents with precision. From minor adjustments to complete transformations, achieve polished results effortlessly.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Watermark for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Polish document Watermarks in other formats with GroupDocs.Watermark for Java

Refine your documents with precision using our comprehensive watermark editing capabilities. Enhance document authenticity effortlessly.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English