I need to make a PDF in landscape format.
<script type="text/javascript">
$(function () {
var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#cmd').click(function () {
doc.fromHTML($('#content').html(), 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
doc.save('sample-file.pdf');
});
});
</script>
I found it out. It is so simple :) The first Param is for landscape in jsPDF()
which is l
for landscape.
var pdf = new jsPDF('l', 'mm', [297, 210]); //The first Param is for landscape or portrait
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