Related Article(s):
Last active
May 22, 2024 21:15
-
-
Save GroupDocsGists/1dd3e04dd9ccff5bb39dcdcf6ed5d30e to your computer and use it in GitHub Desktop.
How To Add Image Watermark to a Document in Node.js solutions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require the GroupDocs.Watermark module | |
const groupdocsWatermark = require('@groupdocs/groupdocs.watermark') | |
// Initialize the Watermarker class | |
const watermarker = new groupdocsWatermark.Watermarker(inDocumentPath); | |
// Create an Image Watermark | |
const imageWatermark = new groupdocsWatermark.ImageWatermark(imageFilePath); | |
// Set Watermark Alignment | |
imageWatermark.setHorizontalAlignment(groupdocsWatermark.HorizontalAlignment.Center); | |
imageWatermark.setVerticalAlignment(groupdocsWatermark.VerticalAlignment.Center); | |
// Add the Watermark to the Document | |
watermarker.add(imageWatermark); | |
// Save the Watermarked Document | |
watermarker.save(outDocumentPath); | |
// Close the Watermarker | |
watermarker.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment