Wednesday, 15 September 2010

php - How to print tables on pdf with Javascript? -



php - How to print tables on pdf with Javascript? -

what's best way print tables in pdf javascript?

for example, have next code, , if click on "show pdf", table appears in pdf in new window. possible implement jspdf library?

<body> <table> <tr> <th>example</th> <th>example2</th> </tr> <tr> <td>value1</td> <td>value2</td> </tr> </table> <br> <input type="button" value="show pdf"> </body>

you should utilize dompdf, : dompdf html pdf converter. @ heart, dompdf (mostly) css 2.1 compliant html layout , rendering engine written in php. style-driven renderer: download , read external stylesheets, inline style tags, , style attributes of individual html elements. supports presentational html attributes.

download dompdf

http://code.google.com/p/dompdf/

<? require "dompdf_config.inc.php"; $html = <<<sty <table> <tr> <th>example</th> <th>example2</th> </tr> <tr> <td>value1</td> <td>value2</td> </tr> </table> </body> sty; $dompdf = new dompdf(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("mypdf.pdf", array("attachment" => 0)); ?>

php javascript table pdf

No comments:

Post a Comment