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

NuxtJS: Error: Could not load html2canvas: Error: Cannot find module 'html2canvas' #2867

Closed
KamranMaqbool opened this issue Aug 20, 2020 · 9 comments

Comments

@KamranMaqbool
Copy link

KamranMaqbool commented Aug 20, 2020

I am trying to use jsPdf in Nuxtjs Application

We have the following code:
import in .vue file
import jsPDF from 'jspdf';

onClick Event for download HTML to pdf
<b-button title="Download" @click="downloadPdf(article.contents)" variant="light" size="sm"> <b-icon icon="file-earmark-arrow-down" variant="primary"></b-icon> </b-button>

in my script section my download function are
downloadPdf(contents) { if (process.browser) { const doc = new jsPDF.default() debugger doc.html(contents, { callback: function(doc) { doc.save(); } }); } },

in My Case contents are HTML string like:
<p>ksdfksd fsd fksd fdfsd</p>

i want to convert HTML String to PDF Document but
Give error in Console are

Uncaught (in promise) Error: Could not load html2canvas: Error: Cannot find module 'html2canvas'
image

@zhuiye
Copy link

zhuiye commented Aug 21, 2020

The same problem, i use html method in react application

image

image

already installed html2canvas and dompurify

image

@HackbrettXXX
Copy link
Collaborator

Probably the same issue as #2846. Will be fixed with PR #2865. Could you test it with the files from the pull request? (need to run npm build first to create the right dist files).

@KamranMaqbool
Copy link
Author

@zhuiye your issue solved or not ?

@KamranMaqbool
Copy link
Author

@HackbrettXXX what's about this issue
it's resolved or not ?
how can i fix this error ?

@Blunderchips
Copy link

@KamranMaqbool Should have been fixing in #2865, has not been published to npm yet.

@KamranMaqbool
Copy link
Author

@HackbrettXXX when are you published to npm
during this time can i use your old version (1.5.0)

@HackbrettXXX
Copy link
Collaborator

This is fixed. I will prepare a release next week.

@KamranMaqbool
Copy link
Author

@HackbrettXXX have you fixed this issue (mean's upload release or not) ?

@HackbrettXXX
Copy link
Collaborator

v2.1.0

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

4 participants