We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

How to set minimal watermark font size in Java

We are using the Watermark Java api and we noticed that the watermark text size cannot be set smaller than 10px. Is this a known defect, or is there any workaround that can set the warkmark font size smaller, such as 5px?

Thanks.

1 Like

@lli23

We couldn’t reproduce this issue using following code and API version 20.5:

com.groupdocs.watermark.licensing.License lic = new com.groupdocs.watermark.licensing.License();
lic.setLicense("license file path here");
Watermarker watermarker = new Watermarker("D:\\source.docx");    
TextWatermark watermark = new TextWatermark("top secret", new Font("Arial", 3));                                                                                
watermarker.add(watermark);                                                                              
watermarker.save("D:\\output.docx");                                                                        
watermarker.close();     

Please have a look at this screenshot (2).PNG (63.7 KB). Different font sizes are tested (e.g. 100, 10, 3) and all are working. Please download/clone this open-source console application and let us know if issue persists.

@lli23

We could reproduce this issue when horizontal, vertical alignments along-with few other Watermark properties are set. Hence, it’s been logged in our internal issue tracking system with ID WATERMARKJAVA-86. You’ll be notified about the outcomes.

@lli23

There’s an update on WATERMARKJAVA-86. If you are using ScaleToParentDimensions

textWatermark.setSizingType(SizingType.ScaleToParentDimensions);

and setScaleFactor:

textWatermark.setScaleFactor(0.5);

Please remove these two scaling commands and you can get any font size (e.g. 2px, 50px). Let us know if you have any issue.