Can we use phantomJs 2 with jsreport rendering shortcut (in NodeJs)



  • I'm trying to use jsreport to generate a pdf using node js on mac, but I'm not sure how to configure it with the jsreport rendering shortcut (like it's used in the code below)

    var http = require('http');
    var jsreport = require('jsreport');
    
    http.createServer(function (req, res) {
    
      jsreport.render("<h1>Hello world</h1>").then(function(out) {
        out.stream.pipe(res);
      }).catch(function(e) {    
        res.end(e.message);
      });
    
    }).listen(1337, '127.0.0.1');
    

  • administrators

    i think you just need to specify the phantomjs version that you are using when calling render.

    jsreport.render({
           template: {
               content: '<h1>Hello world</h1>',
               engine: 'none', // replace this with the engine that you are using
               recipe: 'phantom-pdf',
               phantom: {
                 phantomjsVersion: '2.1.1' // replace this with the exact version of phantom@2 that you have installed.
               }
            }
        })
    


  • Thanks, it's working!


Log in to reply
 

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