Create and apply watermarks on PDF, Word, Excel, PowerPoint, and image files, including JPG and PNG. Fast, powerful, and easy-to-use watermarking tool.
npm install @groupdocs/groupdocs.watermarkPowerful document watermarking API for Node.js (powered by Java) designed to help developers seamlessly add, detect, customize, and remove watermarks in 40+ file formats, including PDFs, Word documents, Excel spreadsheets, PowerPoint presentations, images, Visio diagrams, and more.
!Watermark example
js
'use strict';
const groupdocs = require('@groupdocs/groupdocs.watermak');
// Apply license, required for non-evaluation usage
const license = new groupdocs.License();
license.setLicense("GroupDocs.Watermark.lic");
// Create watermarker
const watermarker = new groupdocs.Watermarker("source.pdf");
const watermark = new groupdocs.TextWatermark('Test watermark', new groupdocs.Font('Arial', 36, groupdocs.FontStyle.Bold | groupdocs.FontStyle.Italic));
watermark.setHorizontalAlignment(groupdocs.HorizontalAlignment.Center);
watermark.setVerticalAlignment(groupdocs.VerticalAlignment.Center);
watermarker.add(watermark);
watermarker.save("result.pdf");
// Exit
process.exit(0);
`
The output file 'result.pdf', is the watermarked version of the original.
$3
`js
'use strict';
const groupdocs = require('@groupdocs/groupdocs.watermak');
// Apply license, required for non-evaluation usage
const license = new groupdocs.License();
license.setLicense("GroupDocs.Watermark.lic");
// Create watermarker
const watermarker = new groupdocs.Watermarker("source.pdf");
// Search by exact string
const textSearchCriteria = new groupdocs.TextSearchCriteria("2017");
// Find all possible watermarks containing some specific text
const possibleWatermarks = watermarker.search(textSearchCriteria);
// Output the results
console.log(Found ${possibleWatermarks.getCount()} possible watermark(s));
// Exit
process.exit(0);
`
Troubleshooting
- Download during installation fails (corporate proxy/firewall): Ensure your environment allows downloading the required JAR during postinstall. If needed, download the file manually to the lib/ directory as described in the Installation Guide.
- Java not found: Make sure Java (JRE 8+) is installed and available on your system PATH.
- Permission issues when writing output files: Verify your process has write access to the target directory.
Licensing
For testing without trial limitations, you can request a 30-day Temporary License:
* Visit the Get a Temporary License page
* Follow the instructions to request your temporary license
* Copy the license file and apply it using the code example
`javascript
'use strict';
const groupdocs = require('@groupdocs/groupdocs.watermark');
// Apply license
const license = new groupdocs.License();
license.setLicense("GroupDocs.Watermark.lic");
``