Free Support Forum - groupdocs.com

Possible to add unremovable and invisible watermark using GroupDocs for Java?


#1

Hello, our team is going to evaluate (using maven repository) GroupDocs Java API to add read-only (unremovable by 3rd party tools) watermark to MS office documents, pdf and images.
We want to make the watermark invisible as well.
Is it possible to watermark unremovable as well as invisible?
Please post links to relevant API reference.
Thank you.

I searched with keywords “invisible”, “encrypt”, and “hidden”, with no relevant result.


#2

@Ecnatneper,

Thanks for your interest in GroupDocs.Watermark.

Yes, you can make the watermark read-only and invisible using GroupDocs.Watermark.

Handling Visibility:

To control the visibility of the watermark, GroupDocs.Watermark provides setOpacity method in TextWatermark and ImageWatermark classes. To make the watermark invisible, you can set the opacity to 0 as shown in the following code sample.

CellsDocument doc = Document.load(CellsDocument.class, "document.xlsx");
// Adding text watermark
TextWatermark textWatermark = new TextWatermark("Test watermark", new Font("Arial", 8));
textWatermark.setOpacity(0);
doc.getWorksheets().get_Item(0).addWatermark(textWatermark);

// Adding image watermark
ImageWatermark imageWatermark = new ImageWatermark("watermark.png");
imageWatermark.setOpacity(0);
doc.getWorksheets().get_Item(0).addWatermark(imageWatermark);

Handling Protection:

To make the watermark read-only, GroupDocs.Watermark provides the locking mechanism that indicates whether editing of the watermark is forbidden or not. In order to lock the watermark, setLocked method is used which is available in the following classes:

To protect the removal of the watermark from PDF documents, GroupDocs.Watermark provides PDF document rasterization. This feature converts the PDF document’s pages into raster images which makes it almost impossible to remove the watermark. For details on this feature, please visit this documentation article.

In case you would have any other question or query, please feel free to let us know.


#3

@ usman.aziz,
Thank you very much for your detailed reply.
Shame on me not realizing setting opacity to 0.
I’ll try your suggestions later.

We also want the watermark (we use image watermark) printed out with full (or original) opacity. Is that possible?
Or how can we prove to those who pirated our copy-righted documents and images?
Using your API to make the watermark opaque or any better ways to prove that those documents with invisible watermarks are originally made by us.


#4

@Ecnatneper,

Thanks for coming back to us.

Yes, the value for the opacity can be from 0 to 1. If you set it to 1, the watermark will be added with full opacity. Please note that the default value for the watermark opacity is also 1, therefore, you can simply comment out setOpacity if you want full opacity of the watermark.

One way to prove is adding the locked opaque watermark which is hard to be removed (as mentioned in previous reply). While the other way is using an invisible watermark that can be searched and found using GroupDocs.Watermark when needed. In this case, if you think someone has pirated your document containing an invisible watermark on it, you can simply scan the document for your watermark (text or image). For more details on how to search watermarks, please visit this documentation article.


#5

@ usman.aziz,
Thanks.
Sorry, I didn’t make it clear that is it possible to make the watermark visible only when printed out?


#6

@Ecnatneper,

We apologize for the misunderstanding. Currently, the feature of adding a print-only watermark is available only for the PDF documents. Please visit this documentation article for more details.

We have also logged it in our Issue Tracking System as WATERMARKJAVA-51 to check whether it is feasible to implement the feature of print-only watermark for other document formats as well. We shall keep you notified in case of any updates.


#7

@ usman.aziz,
I really appreciate your continued support!

I tried adding “WordsLockType.ReadOnlyWithEditableContent” watermark into word 97-2003 upon HttpServeltResponse handler inside Java 7 maven project, but got “java.lang.RuntimeException: java.lang.IllegalStateException: A value for the specified key is missing and the default value is not provided.” on save function with “OutputStream” parameter instead of file path String as used in your documentation.

Somehow interestingly, I didn’t get that exception when I used “WordsLockType.ReadOnly”, and the resulting word97-2003 is really readonly.

Any idea what I did wrong?

I want to watermark documents upon download.

I’m using version 18.6.
I briefly read somewhere your online documentation page that version 18.8 supports only Java 8+.
Maybe I misread that.


#8

@Ecnatneper,

Thanks for coming back to us.

We are able to reproduce your reported issue at our end. We have logged it in our Issue Tracking System as WATERMARKJAVA-52 for further investigation. We shall keep you updated with the status of the issue.

Please note that the restriction of Java 8+ is applicable only for the metered licensing feature. You can feel free to use other features of GroupDocs.Watermark for Java 18.8 in Java 7.


#9

@usman.aziz,
Hello, today my colleague used

PdfDocument pdfDoc = Document.load(PdfDocument.class, bitstreamInputStream);
pdfDoc.addWatermark(watermark);
pdfDoc.rasterize(100, 100, PdfImageConversionFormat.Png);
pdfDoc.save(out);
pdfDoc.close();

to watermark pdf to rasterized images on CentOS 6.5 with JDK 7, and got NullPointerException on

pdfDoc.save(out);

Similar to the previous problem you logged to WATERMARKJAVA-52, “out” is OutputStream.

But words, powerpoints were watermarked with no problem.
And we haven’t got that issue on development machine Windows 7.

Could it be our CentOS 6.5 misconfiguration or overlooked problem?
Can you post the link to WATERMARKJAVA-52?


#10

@Ecnatneper,

Thanks for coming back to us.

To avoid any ambiguity, we have created a separate topic for this inquiry. Please follow this topic for further updates.

I am afraid that you will not be able to access the link to this issue because it is logged in our internal Issue Tracking System which is not public. However, we shall keep you informed in case of any updates.


#11

@Ecnatneper,

We have got an update regarding the support of print-only watermark for MS Office document formats (logged as WATERMARKJAVA-51). MS Office formats do not support print-only watermark by their design. Therefore, I am afraid that the support of the print-only watermark for MS Office documents in GroupDocs.Watermark is not feasible at the moment.