留言板

Convert html page to pdf

Abdulbasit Shaikh,修改在9 年前。

Convert html page to pdf

New Member 帖子: 18 加入日期: 13-5-16 最近的帖子
Hi,

I need to convert one html page which contains different google charts + some static content in <div> tags. Requirement is to use open source library to convert html to pdf and not the paid one. Currently I am using JSPDF(https://parall.ax/products/jspdf) library.

Now the problem is using JSPDF, I am not getting the exact pdf same as html page. Some graphs are not coming properly and some are not coming at all. Means lot of problems I am facing. I searched a lot and found so many options(pdf.js, itext, pd4xml, etc) and tried everything but not able to resolved.

PFA html page which needs to be converted in pdf. Just open html page in browser for seeing the output. It contains one button called "Download as pdf", clicking on the same will generate the pdf. Expected output is pdf should contain same output shown in html page.

Any help would really be appreciated.

Thanks and Regards,
Abdulbasit F Shaikh.
thumbnail
David H Nebinger,修改在9 年前。

RE: Convert html page to pdf

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Because it's not going to work. google charts is javascript running in the browser. As long as you're using a javascript lib for your charting, you're going to find it practically impossible to render into a PDF file.
Abdulbasit Shaikh,修改在9 年前。

RE: Convert html page to pdf

New Member 帖子: 18 加入日期: 13-5-16 最近的帖子
Thanks David.
thumbnail
Juan Gonzalez,修改在9 年前。

RE: Convert html page to pdf

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
I used Flying Saucer in my old times succesfully:

https://code.google.com/p/flying-saucer/

Said that, depending on how those graphs are rendered it would work or not. You can give it a try...If not you could change those graphs to be rendered as simple <img>, in that case that should work.
Abdulbasit Shaikh,修改在9 年前。

RE: Convert html page to pdf

New Member 帖子: 18 加入日期: 13-5-16 最近的帖子
Thanks Juan.