0

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>';
           client.render({
               template: {  content: output }
           }, function(err, pdfResp) {
               pdfResp.pipe(res);
           });

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 ?

Arian
  • 7,397
  • 21
  • 89
  • 177

1 Answers1

0

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
Jan Blaha
  • 3,069
  • 1
  • 22
  • 35
  • We are using centOS 6.6 and we also tried what you suggested. We get all the `svg`s working BUT the text doesn't show up. It's there but it's not visible and when we copy the content to another document (text file) , we see wrangled strings : For example : `ailreu core` instead of `Failure Score` – Arian Jun 12 '15 at 17:48