I have a html-content with dynamic-css in python class which will be later passed to a js file. I need to download this html-content as pdf format.
I have gone through various html to pdf convertor tools(pdfkit,pdfcrowd,wkhtmltopdf) but none of them is able to render the dynamic css content.
I have even tried using windows.document.documentElement for obtaining html content with dynamic css rendered.
But this did not work.
My question is: can we generate dynamic css seperately on python or download the complete pdf using js?
Thanks in advance
I have used JSPDF to download pdf from html. It is easy to use. It should help you in your case:
JS Fiddle Html to pdf: http://jsfiddle.net/xzz7n/1/
JSPDF Site https://parall.ax/products/jspdf
Related
I have an html page which contains graph created with Amcharts
and I need to generate pdf of my html page. Amcharts have provided
this link for exporting html in javascript my question is there is any way to export a page from server-side i.e nodejs.
There is no such tutorial in a given site and so far I have tried phantomjs plugin but it didn't help.
Amcharts has a knowledgebase article showing how to do this. If you prefer an alternative you can try pdfmake and build up the pdf with the png's yourself.
Once you have the pdf you can serve the file over an endpoint on node pretty easily, eg using express.
I have SVG images, and lot of text with inline CSS, in an HTML page. I need to export all of them into PDF. Suggest to me proper technology which caters to my need. I am using JavaScript and jQuery as front end and Python as backend.
UPDATE:
I have tried jsPDF, but it is not preserving the CSS styling and I am not able to export images also.
Do you know the wkhtmltopdf command line tools? I was in a project where I also needed to convert a web page to PDF and I used this library (I used PHP as backend) and it worked very well for me.
I hope I have helped :D
If you want to do it server-side, there's a python package for that:
http://weasyprint.org/
Otherwise, you can do it in the browser but you will loose the CSS.
jsPDF appears to have experimental support for converting HTML to a PDF, or you can programmatically populate a PDF document with similar content. SVG is supported via plugin.
Demo:
http://rawgit.com/MrRio/jsPDF/master/
Github:
https://github.com/MrRio/jsPDF
I want to convert the contents in a <div> to a pdf.
The <div> contains information in various languages as well as images.
I want to use jQuery or C# asp.net.
How can I achieve this?
MrRio/jsPDF Client-side JavaScript PDF generation for everyone.
Simply include the jsPDF library in your , generate your PDF using the many built-in functions, then hook up a button to trigger the download. All the examples here use jQuery.
I want to convert HTML content to pdf. It can be any content i.e. content of a div, table etc.
I have tried jspdf, iText for it but they are not effective.
Among the paid one's pdfcrowd is solving my purpose but I am looking for any open source solution which does not depend third party server.
Please suggest any open source solution to this which can convert html content to pdf effectively(Client Side will be preferable).
In Windows, Mac or Linux, install wkhtmltopdf. wkhtmltopdf is a command line utility to convert HTML to PDF using WebKit. You can download wkhtmltopdf from the linked webpage, or in many Linux distros it can be found in their repositories.
Examples
Convert a remote HTML file to PDF:
wkhtmltopdf http://www.google.com google.pdf
Convert a local HTML file to PDF:
wkhtmltopdf example.html example.pdf
wkhtmltopdf usage You can also display wkhtmltopdf help locally by running wkhtmltopdf -H.
You can try htmltopdf for convert HTML content into a pdf. I have used it and it fulfills my all requirements of converting HTML into pdf.
http://www.phpclasses.org/package/2905-PHP-Convert-HTML-to-PDF-using-Web-services.html
You can use TCPDF for converting HTML to PDF . its free and good features. I tried and its working perfectly even you can convert all html content like images ,or custom css into pdf without any problem by using TCPDF classes .
You can download form below link:
http://sourceforge.net/projects/tcpdf/files/
Regards,
Sanjeev Kumar Goswami
i am using jsGantt javascript library for showing gantt charts in html . now i want to save that generated ganttchart in PDF form how i will use that ??
the problem is with CSS , and JavaScript....
thank you ,
I think you'll need to use a server-side script to do the HTML to PDF conversion, and then link to that script from your HTML report using a popup window.
If you're using PHP then html2pdf will do the trick, or ABCPdf for a Microsoft platform.