Related Article(s):
Last active
May 22, 2024 21:15
-
-
Save GroupDocsGists/721f5c545848637db15ba69a97d6393f to your computer and use it in GitHub Desktop.
How To Add Text 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 a Text Watermark | |
const watermark = new groupdocsWatermark.TextWatermark('top secret', new groupdocsWatermark.Font('Arial', 36)); | |
// Set Watermark Properties | |
watermark.setForegroundColor(groupdocsWatermark.Color.getRed()); | |
watermark.setHorizontalAlignment(groupdocsWatermark.HorizontalAlignment.Center); | |
watermark.setVerticalAlignment(groupdocsWatermark.VerticalAlignment.Center); | |
// Add the Watermark to the Document | |
watermarker.add(watermark); | |
// 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