【问题标题】:download pdf format not proper下载pdf格式不正确
【发布时间】:2016-03-29 08:35:16
【问题描述】:

请检查链接 https://jsfiddle.net/dhaileytaha/1wmk9gsq/14/

<script>
 /*Download option*/
var doc = new jsPDF();
    var specialElementHandlers = { 
 '#editor': function (element, renderer) {
        return true;
    }
    };
          doc.fromHTML($('#example').html(), 55, 55, {
        'width': 170,
    'elementHandlers': specialElementHandlers
    });


document.getElementById("cmd").onclick = function () {

    var pass1= "cool" ;

password=prompt('Please enter your password to Print this page!',' ');

if (password==pass1)
{ 
       doc.save('target-file.pdf');
   } else {
       window.alert('Sorry! You are not Authorsised');   
   }
 }

</script>

它是一个数据表。我能够以正确的格式打印它,但无法以与数据表相同的格式下载。 请帮忙 我想要与 DATATABLE 格式相同的 pdf 格式。

【问题讨论】:

标签: javascript jquery


【解决方案1】:

您使用的 jspdf 资源可能是旧的,无法正常工作。

你应该做的另一件事是用 div 标签包装内容。

我用以下版本尝试了你的小提琴示例,它可以工作。 http://mrrio.github.io/jsPDF/dist/jspdf.debug.js

【讨论】:

  • 你能分享你的小提琴吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-02-28
  • 1970-01-01
  • 2012-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多