This issue only happens for Docx files, it does not happen for PDFs.
Here is a code snippet that I used to test this issue, I used the AddATextWatermark class from the GroupDocs Git repository and did a few changes to it, and I update the watermark lib to 21.3 because the project was using an older version.
public static void run() {
// Constants.InDocumentPdf is an absolute or relative path to your document. Ex: "C:\\Docs\\document.pdf"
Watermarker watermarker = new Watermarker(Constants.InDocumentDocx);
TextWatermark watermark = new TextWatermark("top secret", new Font("Arial", 36));
watermark.setForegroundColor(Color.getRed());
watermark.setHorizontalAlignment(HorizontalAlignment.Center);
watermark.setVerticalAlignment(VerticalAlignment.Center);
watermark.setRotateAngle(45);
watermark.setBackground(false);
watermarker.add(watermark);
watermarker.save(Constants.OutDocumentDocx);
watermarker.close();
}
SO: Windows 11
Java version: RedHat OpenJDK 11.0.15
GroupDocs.Watermark version: 21.3
Git Project: GitHub - groupdocs-watermark/GroupDocs.Watermark-for-Java: GroupDocs.Watermark for Java examples, plugins and showcase projects
Git Revision: fed5e7f