Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active May 22, 2024 21:04
Show Gist options
  • Save GroupDocsGists/7304eb793d9916a5c40825f89841b964 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/7304eb793d9916a5c40825f89841b964 to your computer and use it in GitHub Desktop.
Simple Example of GroupDocs.Watermark for Node.js via Java
// require the GroupDocs.Watermark module
const groupdocsWatermark = require('@groupdocs/groupdocs.watermark')
// Initialize the watermarker object
const watermarker = new groupdocsWatermark.Watermarker('Example.docx');
// Create the font object which will be used for the watermark text
const font = new groupdocsWatermark.Font('Arial', 36, groupdocsWatermark.FontStyle.Bold);
// Instantiate the watermark class
const watermark = new groupdocsWatermark.TextWatermark('Test watermark', font);
// Add watermark with the watermarker object
watermarker.add(watermark);
// Save new document with the watermark added
watermarker.save('outFile.docx');
// Close the watermarker object to finalize properly
watermarker.close();
console.log('Watermark added and document saved successfully.');
process.exit(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment