I am using temporary license and facing the same issue. There is background rectangular box around the text. How can we we remove that.
Watermarker watermarker = new Watermarker(inputPDF);
TextWatermark watermark = new TextWatermark (“OBSOLETE”, new Font(“Arial”, 36));
watermark.setForegroundColor(Color.getGray());
watermark.setHorizontalAlignment(HorizontalAlignment.Center);
watermark.setVerticalAlignment(VerticalAlignment.Center);
watermark.setScaleFactor(0.5);
watermark.setOpacity(0.3);
watermark.setRotateAngle(-45);
watermarker.add(watermark);
watermarker.save(inputPDF);
watermarker.close();
@smanore
This issue is reproduced at our end. Therefore, we have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WATERMARKJAVA-134
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@smanore
We are working on this ticket and you’ll be notified when the issue is fixed. However, below is the workaround to get rid of the background color:
// Create a new Watermarker object with the input PDF file
Watermarker watermarker = new Watermarker(inputPDF);
// Create a text watermark with the text "OBSOLETE" and a font size of 36 using the Arial font
TextWatermark watermark = new TextWatermark("OBSOLETE", new Font("Arial", 36));
// Set the foreground color of the watermark to gray
watermark.setForegroundColor(Color.getGray());
// Set the horizontal alignment of the watermark to center
watermark.setHorizontalAlignment(HorizontalAlignment.Center);
// Set the vertical alignment of the watermark to center
watermark.setVerticalAlignment(VerticalAlignment.Center);
// Set the scale factor of the watermark to 0.5 (50% of the original size)
watermark.setScaleFactor(0.5);
// Set the opacity of the watermark to 0.3 (30% opaque)
watermark.setOpacity(0.3);
// Set the rotate angle of the watermark to -45 degrees (counter-clockwise rotation)
watermark.setRotateAngle(-45);
// Create PdfArtifactWatermarkOptions to specify additional options for the watermark
PdfArtifactWatermarkOptions options = new PdfArtifactWatermarkOptions();
// Add the watermark to the watermarker with the specified options
watermarker.add(watermark, options);
// Save the watermarked PDF file
watermarker.save(inputPDF);
// Close the watermarker
watermarker.close();
@smanore
We couldn’t reproduce this issue using API version 24.5. Please upgrade to the latest version.