Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Could not load dompurify: Error: Could not load dompurify #3045

Closed
kantsverma opened this issue Dec 22, 2020 · 4 comments
Closed

Error: Could not load dompurify: Error: Could not load dompurify #3045

kantsverma opened this issue Dec 22, 2020 · 4 comments

Comments

@kantsverma
Copy link

kantsverma commented Dec 22, 2020

Feature requests, bug reports etc. are very welcome as issues. But questions are directed to stackoverflow with the tag jspdf.

If you are facing issues with utf-8 characters, please refer to #2677.

Note that bug reports should follow these guidelines:

  1. A bug should be reported as an mcve
  2. Make sure code is properly indented and formatted (Use ``` around code blocks)
  3. Provide a runnable example.
  4. Try to make sure and show in your issue that the issue is actually related to jspdf and not your framework of choice your setup.

When i use the below code it will occur the error else its working fine.
URL i am using

<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.2.0/jspdf.umd.min.js"></script>
<script>
  var jsPDF = window.jspdf.jsPDF;
  var html2canvas = window.html2canvas;
  const doc = new jsPDF();
  // current date
  //var myDate = new Date();
  // render html of product description
  var renderHtml = $('.product-single__description').html();
  console.log('html => '+renderHtml);
  doc.html(renderHtml , {
	  callback: function () {
            window.open(doc.output('bloburl')); // to debug
	  },
	  x: 105,
	  y: 120,
  });
</script>
@HackbrettXXX
Copy link
Collaborator

As the error message says, you need to load dompurify. When you're using script tags, include a script tag for Dompurify.

@kantsverma
Copy link
Author

But i loaded the library from cdn link so its should work

@HackbrettXXX
Copy link
Collaborator

Dompurify is an external/optional dependency like html2canvas and is not included in the jspdf bundle.

@kantsverma
Copy link
Author

yes it work for me but not the another issues is .html() print large size of text :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants