How To Export Table Html Table To Pdf?
Solution 1:
There is a Javascript library called jsPDF which is PDF files on client side. They also have examples that demonstrates how to use the library. They have an example called addHTML() which might be what you are looking for.
In your case you might want to do something like this:
pdf.addHTML(document.getElementById('DIV_ID'),function() {
varstring = pdf.output('datauristring');
$('.preview-pane').attr('src', string);
});
On the examples page they write that IE6+, Firefox 3+, Chrome, Safara 3+ and Opera should work.
Solution 2:
jsPDF is not supported on IE 9. jsPDF used Downloadify to get around this, but it is no longer supported. You can use a number of polyfills, but they are still being patched (e.g. Blob.js).
From personal experience, I never got jsPDF to work in IE 9. It's worth trying if you really need to support IE 9, but be aware that you will have to use multiple polyfills.
Here are the specific issues I encountered - IE 9 does not support the following which are used by jsPDF:
- Blob (use Blob.js)
- atob/btoa
- console.trace (just remove the calls)
- Typed Arrays (try this)
Post a Comment for "How To Export Table Html Table To Pdf?"