I'm trying to create a Salesforce Lightning Web Component to create a custom Quote PDF using jsPDF. I mastered to use the external chart.js library with uploading it as a static resource, but when I try to do the same with jsPDF.js I always get a security error "SecureElement does not allow access to charset" while calling jsPDF.

Has anyone an answer to that or an alternative solution to create PDFs with Lightning Web Components?

  • Seems like jsPDF is not locker complaint . You might have to find alternative locker complaint workaround for unsupported apis Mar 13, 2019 at 23:51
  • Hi @MohithShrivastava thank you for your answer. Unfortunately I thought so, do you have any hints for a PDF library that is Locker compliant? Thanks, Michael
    – Michael
    Mar 14, 2019 at 0:25
  • May be you should try building like a visualforce for your requirement and then you can render natively on the platform or attach as a file . Mar 14, 2019 at 0:31
  • @mohithshrivastava What about disabling locker by forcing your component to API version 39 per this salesforce guidance?
    – bkwdesign
    Sep 2, 2022 at 12:52

1 Answer 1


I found this post because I am seeing this:

SecureElement does not allow access to charset

working with a different 3rd party JavaScript library.

For me this is reported as a warning not an error and the JavaScript does load. Looking into this in the debugger, it is the loadScript call itself that tries to set this charset so I assume this warning will appear for any JavaScript loaded via loadScript.

Of course the JavaScript itself may still not work under the platform's security mechanisms... just don't be distracted by this warning.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .