Javascript 为什么下面的jspdf代码会在下一页打印数据?

Javascript 为什么下面的jspdf代码会在下一页打印数据?,javascript,jspdf,Javascript,Jspdf,下面的代码是一段java脚本,它使用jspdf生成html文件的pdf。我使用html呈现程序,它从一个id为#formcare的.jsp文件中获取内容 function formpdf(){ var doc = new jsPDF(); var imgData = 'data:image/png;base64,iVBORwuy9B5xcZ3kvrHCTmy'; //image url doc.addImage(imgData, '

下面的代码是一段java脚本,它使用jspdf生成html文件的pdf。我使用html呈现程序,它从一个id为#formcare的.jsp文件中获取内容

function formpdf(){
         var doc = new jsPDF();
         var imgData = 'data:image/png;base64,iVBORwuy9B5xcZ3kvrHCTmy'; //image url
              doc.addImage(imgData, 'PNG', 90, 05, 25,25);
        doc.setFont("times");
        doc.setFontType("normal");
        doc.setFontSize("14");
        doc.text(90,35, 'IDeaS INDIA');
        doc.text(50,40,'Reimbursement Form For Employee Day Care');

        doc.setFontSize("12");
        doc.text(70,55,document.getElementById("date").value);
        doc.text(70,60,document.getElementById("name").value);
        doc.text(70,65,document.getElementById("department").value);
        doc.text(70,70,document.getElementById("designation").value);
        doc.text(70,75,document.getElementById("daycare").value);
        doc.text(70,80,document.getElementById("childName").value);
        doc.text(70,85,document.getElementById("dob").value);
        doc.text(70,90,document.getElementById("age").value);           

        var specialElementHandlers = {
              '#editor': function(element, renderer){
                  return true;
              }
        };

        //formcare is my tableId in .jsp file
         doc.fromHTML($('#formcare').get(0), 15, 50, {
              'width': 170, 
              'elementHandlers': specialElementHandlers
        });

         doc.text(10,190,'Note-Employees to ensure that the DAY CARE Center is registered under shop act establishment.');
        doc.text(10,200,'Employees will be responsible towards the safety of the child and company holds no obligation.'); 
        doc.save('form.pdf');           
    }
根据HTML,渲染仍处于早期阶段。 它不支持css和样式


所以,如果您想要在单个页面中显示文档,请检查您正在呈现的html/div。尝试减少html/div中的

或其他换行标记如果使用引导设置样式,此问题将得到解决