Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active May 22, 2024 21:15
Show Gist options
  • Save GroupDocsGists/1dd3e04dd9ccff5bb39dcdcf6ed5d30e to your computer and use it in GitHub Desktop.
Save GroupDocsGists/1dd3e04dd9ccff5bb39dcdcf6ed5d30e to your computer and use it in GitHub Desktop.
How To Add Image Watermark to a Document in Node.js solutions
// 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