pofider / phantom-html-to-pdf

Highly scalable html to pdf conversion using phantom workers
MIT License
159 stars 33 forks source link

Links aren't clickable #35

Closed cmoulliard closed 8 years ago

cmoulliard commented 8 years ago

Here is the code that I'm using to render the HTML file (published here) - https://redhat-microservices.github.io/lab_swarm_forge-keycloak/

var conversion = require("phantom-html-to-pdf")();
var fs         = require('fs');

var res = fs.createWriteStream('generated_content/hol.pdf');
var src = fs.readFileSync('/Users/chmoulli/MyProjects/litoria/generated_content/hol.html');

conversion({
      html: src.toString(),
      allowLocalFilesAccess: true,
      format: {
          quality: 100
      }
    }, function(err, pdf) {
    console.log(pdf.logs);
    console.log(pdf.numberOfPages);
    pdf.stream.pipe(res);
});

The pdf file generated looks good excepted that the links aren't clickable

screenshot 2016-08-31 11 23 44 screenshot 2016-08-31 11 23 31

pofider commented 8 years ago

phantomjs@1.x which is included by default in this package doesn't support clickable links in pdf.

However it is supported in phantomjs@2.x which you can opt in, see here