Load from stream
The following example democtrates how to create a watermarker for a document stream:
advanced_usage.loading_documents.LoadFromStream
// Constants.InDocumentDocx is an absolute or relative path to your document. Ex: "C:\\Docs\\document.docx"
FileInputStream document = new FileInputStream(Constants.InDocumentDocx);
Watermarker watermarker = new Watermarker(document);
// use watermarker methods to manage watermarks
TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 12));
watermarker.add(watermark);
watermarker.save(Constants.OutDocumentDocx);
watermarker.close();
document.close();
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples:
Free online document watermarking App
Along with full featured Java library we provide simple, but powerful free Apps.
You are welcome to add watermark to PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Watermarking App.