What HTML libraries for PDF process javascript?

I am trying to figure out how to create a PDF from HTML that contains charts generated using the javascript library. Dompdf was my original conversion library, but after adding map maps it fails. I looked around (especially at https://stackoverflow.com/questions/3178448/list-of-html-to-pdf-converters ) and searched Google for a while, but didn't seem to find that it explicitly supports javascript. I am working on PHP. I saw someone mention in this article that they used php-wkhtmltox in all cases, but a diagram created by another javascript library. Is this my only chance? I could pay a couple hundred dollars if there is a commercial option.

If this is something that is really impossible with current libraries, what exactly is the task, which makes it harder to convert the html generated by javascript vs. normal html?

thanks

+7
source share
3 answers

You can use wkhtmltopdf

Just extract it to your server, run the command (see the manual here ).

Thanks.

+8
source

You can run JavaScript in the PDF API Pdfcrowd HTML for PDF. You can download the client library for PHP and try.

This is a commercial SaaS solution, here are the documents: http://pdfcrowd.com/html-to-pdf-api/ .

+3
source

PDFPY

sudo npm i pdfpy 

var pdfpy = require ('pdfpy');

File

 var pdfpy = require('pdfpy'); var data = { //the key as to be same as below input: "./test.html", output: "./output.pdf" } pdfpy.file(data, function(err, res) { if(err) throw err if(res) console.log("success") }); 

URL

 var pdfpy = require('pdfpy'); var data = { //the key as to be same as below input: "http://google.com", output: "./output.pdf" } pdfpy.url(data, function(err, res) { if(err) throw err if(res) console.log("success") }); 
+1
source

All Articles