One of the main features of the GroupDocs.Watermark library is adding image watermarks to documents. You may add watermarks to documents or images from local disks, as well as from streams. For a full list of supported document formats, check Supported formats.
To add an image watermark perform the following sample:
constgroupdocs.watermark=require('@groupdocs/groupdocs.watermark')functionaddAnImageWatermark(){constwatermarker=newgroupdocs.watermark.Watermarker("sample.pdf");constimageWatermark=newgroupdocs.watermark.ImageWatermark("sample.png");imageWatermark.setHorizontalAlignment(groupdocs.watermark.HorizontalAlignment.Center);imageWatermark.setVerticalAlignment(groupdocs.watermark.VerticalAlignment.Center);watermarker.add(imageWatermark);watermarker.save("sample.pdf");watermarker.close();console.log('Image watermark added and document saved successfully.');}
What’s next
GroupDocs.Watermark offers many more capabilities for adding image watermarks. It’s possible from streams, use absolute or relative positioning, and so on.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.