首页 文章

导入Js PDF的自动插件时出错

提问于
浏览
1

我只是在试图将这个插件导入我的项目时感到非常痛苦 .

我从他们的GitHub获得链接https://github.com/simonbengtsson/jsPDF-AutoTable

我将脚本添加到HTML头但它无法正常工作 .

<script src="https://github.com/simonbengtsson/jsPDF-AutoTable"></script>

我使用js pdf没有导入任何东西,它工作,但我不能使用该插件

function(){

      var pdf = new jsPDF();
      //This lane is not working
      //pdf.autoTable(headerTABLE, myTableArray);
      //
      pdf.addPage();
      var dataURLLogo = canvasLogo.toDataURL("image/jpeg;base64");
      var dataURLLogoSEFAC = canvasLogoSEFAC.toDataURL("image/jpeg;base64");
      var dataURLGrafica = canvas.toDataURL("image/jpeg;base64");

      pdf.setFontSize(25);
      pdf.setTextColor(159, 233, 96);
      pdf.setFontType('bold');
      pdf.addImage(dataURLLogo, 'jpeg', 35,25,20,20);

错误:pdf.autoTable不是一个函数

抱歉我的英语 . 请帮忙!

1 回答

  • 1

    最后我得到了anwser:

    只需在m html head中的所有其他脚本之前添加这两个脚本 .

    <script src="https://cdn.rawgit.com/simonbengtsson/jsPDF/requirejs-fix-dist/dist/jspdf.debug.js"></script>
        <script src="https://unpkg.com/jspdf-autotable@2.3.2"></script>
    

    感谢所有试图回答我的问题的人!

相关问题