I am trying to use the JsPdf library to create a pdf based on html elements. I am wanting to know if it is possible to do with a div border or if i have to use the doc.line property and essentially draw each line around my div. I.E.
var doc = new jsPDF()
doc.line(20, 20, 60, 20)
I would much rather use <div style="border: solid; width: 300px ">
Has anyone had any luck with this?
Here is my Fiddle
How about using jsPdf in conjunction with Html2Canvas? Render the html to canvas, then add the canvas to the pdf as an image like so:
var img = canvas.toDataURL("image/png");
doc.addImage(img, 'JPEG', 300, 200);
doc.save('test.pdf');
See fiddle for full example: http://jsfiddle.net/nLLuvnwL/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With