as the title says i'm trying to figure out how to embed a watermark on every page of a pdf file using image-watermark library. Actually i'm only able to add a text watermark on file with only one page so i'm wondering if there's a possibility to accomplish this task.
Here's my code with a destination path and a response to the client with the link to download
let optionsWatermark = {
'text': 'testo di prova',
'color' : 'rgb(154, 50, 46)',
'dstPath': `public/watermarked/${pdf}`
}
watermark.embedWatermark(`public/uploads/${pdf}`, optionsWatermark)
res.status(200).json({
data: 'Watermark added correctly',
link: `/watermarked/${pdf}`
})
console.log('Your watermark has been added successfully')
You cannot add a water mark to multiple pages using your image-watermark
library. You could convert each page into an image, apply the watermark, then re-create a new pdf using those images though.