jsreport doesn't render text


I have the following code , the result is a pdf which doesn't have any visible text in it. (I guess it renders it as the same color of the background even thoguh we change its colour in the inline style of the html)

var client = require("jsreport-client")('https://localhost:443');
var output = '<html><body><h1 style="color:blue;margin-left:30px;">This is a heading.</h1></body></html>';
               template: {  content: output }
           }, function(err, pdfResp) {

When we copy and paste the content of the pdf into a text pad , the result is :

?ihsish issi aa gheadinhadinge

Any idea how to solve it ?


I would guess phantomjs is missing some dependencies (fonts) required for rendering pdf. It runs for me if I spin up fresh centos VM on azure but I see people complaining sometimes required phantomjs dependencies are not preinstalled. Adding the missing package depends on your distribution

For example on ubuntu you may need to run:

sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev

on centos

sudo yum install freetype fontconfig
By : Jan Blaha

This video can help you solving your question :)
By: admin