【问题标题】:All the datas are not coming in pdf - JSPDF所有数据都不是 pdf 格式 - JSPDF
【发布时间】:2015-12-05 03:21:39
【问题描述】:

我正在使用 jspdf 将 html 转换为 pdf

在这里,我的页面比较长。大约 2 到 3 页。

如果我转换了,有些内容不会出现。有些不在pdf中

html2canvas(document.body).then(function(canvas) {
                background:'#fff',
                document.getElementById("cisForm").appendChild(canvas);
                document.body.appendChild(canvas);
                var context = canvas.getContext("2d");
                context.fillStyle="#FFFFFF";

                 l = {
                     orientation: 'p',
                     unit: 'pt',
                     format: 'a3',
                     compress: true,
                     fontSize: 8,
                     lineHeight: 1,
                     autoSize: false,
                     printHeaders: true
                 };

                var doc = new jsPDF(l, "", "", "");
                doc.addImage(canvas.toDataURL("image/jpeg"), 'jpeg', 0,0)
                window.location=doc.output("datauristring")
                //doc.save('sample-file.pdf');
            });

有没有设置显示pdf中的所有数据?

【问题讨论】:

    标签: javascript pdf jspdf html2canvas


    【解决方案1】:

    在 html2canvas 方法的 background:'#fff' 选项之后添加pagesplit:true。这将添加页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-05
      • 1970-01-01
      • 2021-12-07
      • 2013-03-21
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      相关资源
      最近更新 更多