I'm trying to figure out how to generate a PDF from HTML that contains charts generated with the flot javascript library. Dompdf was my original conversion library but after adding flot charts it fails miserably. I've looked around SO (particularly at ) and googled for a while but can't seem to find any that explicitly provide javascript support. I'm working in PHP. I saw someone mention in that post that they had used php-wkhtmltox successfully in all cases but a chart generated by a different javascript library. Is that my only chance? I could possibly pay up to a couple hundred dollars if there is a mercial option available.
If this is something that really isn't possible with current libraries, what exactly is the challenge that makes it so much harder to convert html generated by javascript vs. normal html?
Thanks
I'm trying to figure out how to generate a PDF from HTML that contains charts generated with the flot javascript library. Dompdf was my original conversion library but after adding flot charts it fails miserably. I've looked around SO (particularly at https://stackoverflow./questions/3178448/list-of-html-to-pdf-converters) and googled for a while but can't seem to find any that explicitly provide javascript support. I'm working in PHP. I saw someone mention in that post that they had used php-wkhtmltox successfully in all cases but a chart generated by a different javascript library. Is that my only chance? I could possibly pay up to a couple hundred dollars if there is a mercial option available.
If this is something that really isn't possible with current libraries, what exactly is the challenge that makes it so much harder to convert html generated by javascript vs. normal html?
Thanks
Share Improve this question edited May 23, 2017 at 12:09 CommunityBot 11 silver badge asked Feb 1, 2011 at 4:09 Dave NovelliDave Novelli 2,2145 gold badges34 silver badges46 bronze badges 03 Answers
Reset to default 8You can use wkhtmltopdf
Just extract it onto your server, run the mand (check out the manual here).
Thank you.
The Pdfcrowd HTML to PDF online API can run JavaScript. You can download a client library for PHP and give it a try.
It is a mercial SaaS solution, here is the docs: http://pdfcrowd./html-to-pdf-api/.
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.",
output: "./output.pdf"
}
pdfpy.url(data, function(err, res) {
if(err) throw err
if(res) console.log("success")
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743744996a4499841.html
评论列表(0条)