I am trying to download in PDF format in lightning component. I have added jsDPF zip file in static resource. Static rescource name:jsPDF, zipFile name:jsPDF,Folder name:jsPDF-1.3.2

On previewing application, I am getting below error: enter image description here


<aura:component >   
<ltng:require scripts="/resource/jsPDF/jsPDF-1.3.2/jspdf.js"
<div id="prinpdf"><h1>Ejemplo PDF</h1></div>


doInit : function(component, event, helper) {
    var pdf = new jsPDF();
    var canvas = pdf.canvas;
   //canvas.height = 72 * 11;
    //canvas.width= 72 * 8.5;;

    // can also be document.body
    var text = document.getElementById('prinpdf');
    pdf.text(20, 20, 'prinpdf');


<aura:application >
  • 1
    can you change your component api version to 39 and try ? just trying to rule out if its because of locker service – RedDevil Jul 13 '18 at 10:15
  • I changed it to 39 and still error persists – devforce Jul 13 '18 at 10:18

I changed my reference to jspdf.debug.js and it worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.