Closed iii-james closed 1 year ago
I am using this post as a reference. I have a pdf that has 3 pages. I only want to merge a watermark on the second one. Is this possible with pdfUtils?
const jsreport = require('jsreport-proxy') async function afterRender(req, res) { const watermarkRes = await jsreport.render({ template: { name: 'Watermark' } }) const $pdf = await jsreport.pdfUtils.parse(res.content) const pagesToMerge = new Array($pdf.pages.length).fill(watermarkRes.content) const originalBuffer = Buffer.from(res.content) const withWatermarkBuffer = await jsreport.pdfUtils.merge(originalBuffer, pagesToMerge) res.content = await jsreport.pdfUtils.append(res.content, withWatermarkBuffer) }
probably the wrong place for a general question. closing and moving it to the forum.
I am using this post as a reference. I have a pdf that has 3 pages. I only want to merge a watermark on the second one. Is this possible with pdfUtils?