2

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?

3
  • Seems like jsPDF is not locker complaint . You might have to find alternative locker complaint workaround for unsupported apis Mar 13 '19 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 '19 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 '19 at 0:31
0

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.

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.