Convert HTML Div to PDF via Jquery -
im trying convert div pdf.
this html code:
i can download fine want show in pdf file div float:left aligned div float:right.
<script lang="javascript" type="text/javascript"> function run() { var pdf = new jspdf('p', 'pt', 'letter'), source = $('#content')[0], margins = { top: 40, bottom: 40, left: 40, right: 40, width: 522 }; pdf.fromhtml( source, margins.left, margins.top, { 'width': margins.width }, function (dispose) { pdf.save('test.pdf'); }, margins ); }; </script type = "text/javascript">
<!doctype html> <html> <head> <meta charset="utf-8"> <title>html2pdf</title> <body> <div id="content" style = "width: 100px"> <div id = "name" style="float:right"> <div id ="rey"> rey </div> <div id ="norbert"> norbert </div> </div> <div id = "age" style="float:left; width:50px">age</div> </div> <div id = "button" style ="margin-top:50px"> <button id="cmd" onclick ="run()">generate pdf</button> </div> <script src="c:\users\besmonte\desktop\for practice\jspdf.debug.js"></script> <script src="c:\users\besmonte\desktop\for practice\jquery.min.js"></script> </body> </html>
right show div left in first row, , div right in next row. please.
as stated in comments jspdf not support css is.
but found post has reference htmltocnavas plugin help.
Comments
Post a Comment