Adding a watermark alters the original word document

Hello,

We’re trying to add watermark in Word documents using the Java module groupdocs-watermark.

Watermarks are being added succesfully, but they alter the original document (blank spaces/lines or modifying text alignment).

This is blocking because the final document (without any watermark) would be different than the watermarked one.

I’ve set up a full reproduction example and added it in this thread (the only missing part is our licence file set in Constants.LicenseFilePath :slight_smile:).

Examples.zip (45,2 Ko)

Here are the issues with the watermarked files :

  • document.docx and document3.docx : one line of “RANDOM TEXT RANDOM TEXT” is left-aligned instead of right-aligned.
  • document2.docx : blank spaces are added in the document, making it takes 2 pages instead of 1.

In addition, there is a GRAVE log during the processing :

GRAVE:
java.lang.UnsatisfiedLinkError: ‘java.util.Map com.groupdocs.watermark.internal.c.a.w.internal.a1.a.bv(int, java.lang.String)’

Any help would be really appreciated.

Thanks,
Regards.

Hi again,

I’ve found that the AllowOnlyFormFields mode addd locked section, which seems to be the origin of the issue :

image.png (3,8 Ko)

I’ve tried the ReadOnlyWithEditableContent mode which seems to work fine (my users should have the possibility to edit the document), but all the content is highlighted when document is opened (because Word displays editable areas with highlight) which is annoying.

Regards.

@Samoth
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-147

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.

Hi @Samoth ,
We are still investigating the described behavior. In the meantime, I’d like to ask if you truly need to use the locking mechanism for the applied watermark. If not, you could try removing the use of WordProcessingWatermarkPagesOptions and updating your code as follows:
Instead of:
watermarker.add(watermark, options);
Try:
watermarker.add(watermarks);

This approach will insert the watermark into the document’s header section. But user can still edit or select the watermark by switching to the header/footer editing mode in Word. This should help avoid the changes in spacing, alignment, or highlighting caused by the locking mechanism.
Let us please know if this improves the situation.

Hi @alexndr,

Thanks for your feedback.

I’m afraid that we really need to use the locking mechanism, because we have the requirement to identify document coming from production, and others.

Thus, a locked watermark is the most suitable solution for our need (because documents can also be printed).

Regards.

@Samoth

This scenario is still under investigation. We’ll notify you in case of any update.