javascript - How to break word in pdf header, PDF generated using jsPDF -
how break words in headers in pdf file, while generating pdf using jspdf(i.e. want break headers "hello world" 2 lines) , how set font size in jspdf.
i have tried pdf.setfontsize(12);
, not work me.
any appreciated. thanks.
code:
var pdf = new jspdf('l', 'pt', 'a3') , source = $('#tableid')[0] , specialelementhandlers = { } , margins = { top: 20, bottom: 20, left: 30, width: 922 }; pdf.fromhtml( source // html string or dom elem ref. , margins.left // x coord , margins.top // y coord , { 'width': margins.width // max width of content on pdf , 'elementhandlers': specialelementhandlers }, function (dispose) { pdf.save('test.pdf'); }, margins )
if want split hello , world on 2 different lines, add newline \n
between hello
, world
: "hello\nworld"
example:
var pdf = new jspdf(); pdf.setfontsize(12); pdf.text(10, 10, "hello\nworld");
or add 2 text fields:
doc.text(10, 10, "hello"); doc.text(10, 25, "world");
ps. more if post code.
Comments
Post a Comment