blank page is rendering when there are no data in appended template
-
Hello @bjrmatos26 @jan_blaha
I am using pdfutils for one of my report. but when there are no data for last appended template then it's returning blank page how I can to solve this?
Here is a playground
Thanks!
-
Can we do anything for this?
-
-
Hello @andribo
No, Merge will not help here as we need to append or prepend the pages.
Thanks for your response!
-
You can use script to post-process the pdf and remove the blank last page.
https://jsreport.net/learn/pdf-utils#usage-in-script
For example like this:const jsreport = require('jsreport-proxy') async function afterRender (req, res) { const $pdf = await jsreport.pdfUtils.parse(res.content, true) if (!$pdf.pages[$pdf.pages.length - 1].text) { res.content = await jsreport.pdfUtils.removePages(res.content, $pdf.pages.length) } }
-
Thanks! @jan_blaha