Blank Page When Appending Reports
-
I have four 2-page "Order" report templates. These reports can be generated separately just fine. The user also wants to print all four reports at once. To do this, I created another "OrderAll" report, which is blank and under pdf-utils I added all four templates as "append", but now I have a blank first page. I could reorder them and set them all as "prepend", but then I get a blank page at the end (the best option, but still not perfect). If I set the first template template as "merge" it looks great, but it's missing the first template's second page. Is there an easier way to print four 2-page report templates at once without having a blank page?
-
You can implement the pdf utils operations problematically inside scrips. Check the documentation. This opens many approaches to you.
https://jsreport.net/learn/pdf-utils#usage-in-scriptPerhaps the simplest is just to use
removePages
to remove the first page.
https://playground.jsreport.net/w/anon/plnz68alconst jsreport = require('jsreport-proxy') async function afterRender (req, res) { res.content = await jsreport.pdfUtils.removePages(res.content, 1) }
-
Is pdfUtils.removePages a newer function?
TypeError: jsreport.pdfUtils.removePages is not a function at Object.afterRender (evaluate-user-script.js:4:43) at __runAfter (/var/www/jsreportapp/node_modules/jsreport-scripts/lib/scriptEvalChild.js:127:28) at Object.base.apply (/var/www/jsreportapp/node_modules/vm2/lib/contextify.js:469:32) at evaluate-user-script.js:7:1 at Script.runInContext (vm.js:135:20) at VM.run (/var/www/jsreportapp/node_modules/vm2/lib/main.js:219:62) at run (/var/www/jsreportapp/node_modules/jsreport-core/lib/render/safeSandbox.js:183:19) at module.exports (/var/www/jsreportapp/node_modules/jsreport-scripts/lib/scriptEvalChild.js:170:5) at process.<anonymous> (/var/www/jsreportapp/node_modules/script-manager/lib/worker-processes.js:66:36) at process.emit (events.js:197:13)
We're using version: 2.6.1
-
Since 2.10.0 apperantly.
https://github.com/jsreport/jsreport/releases/tag/2.10.0
-
I'm afraid to upgrade to the newest version because it'll probably break stuff. Is it possible to upgrade to version 2.10.0?
Would the command line to upgrade be?:npm install @jsreport/jsreport-cli@2.10.0 -g
-
Open your
package.json
, update the dependencyjsreport
to the2.10.0
, and hitnpm install
.However, the
2.11.0
is the last v2 version and should be the most stable.
-
Upgrading to 2.11.0 did the trick. Thanks!