jsreport-pdf-utils



  • Dears,
    I am facing some problems with jsreport-pdf-utils in a nodejs based app.
    i have the following:

    jsreport.init().then(function () {
                return jsreport.render({
                    template: {
                        engine: 'handlebars',
                        content: "{{$pdf.pageNumber}} / {{$pdf.pages.length}}<h1>Hello from Page 1</h1> <div style='page-break-before: always;'></div><h1>Hello from Page 2</h1><div style='page-break-before: always;'></div><h1>Hello from Page 3</h1>",//fs.readFileSync(path.join(__dirname, 'policyPrint.hbs')).toString(),//'<h1>Hi World{{foo}}</h1>',
                        shortid: 'header',
                        recipe: 'phantom-pdf',
                        helpers: '',//helpers,
                        pdfOperations: [{type: 'merge', renderForEveryPage: true, templateShortid: 'header' }]
                    },
    

    this example is taken from https://playground.jsreport.net/studio/workspace/BkEHf9MNG/5
    and trying to make it work in a nodejs based app, but i cant seem to get it working.

    an error is occurring:

    Error: Engine must be specified
        at invokeRender (C:\code\myTestApp\node_modules\jsreport-core\lib\render\render.js:67:11)
    

    any idea how to solve it?

    Thanks in advance.



  • Your code looks strange.
    You render a template with shortid header and try to merge in the same template with shortid header?
    Do you have template with shortid header actually stored in jsreport store? In other words can you render it just by calling jsreport.render({ template: { shortid: 'header' } }) ?


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.