L.S*_*L.S 1 html javascript php jspdf
我需要以横向格式制作PDF。
<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>
Run Code Online (Sandbox Code Playgroud)
我发现了。就这么简单:) 第一个参数是景观,jsPDF()
其中是l
景观。
var pdf = new jsPDF('l', 'mm', [297, 210]); //The first Param is for landscape or portrait