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

Upgrade html2canvas to html2canvas-pro in order to support the oklch() color function. #3748

Open
vijaykerure opened this issue Jul 14, 2024 · 7 comments

Comments

@vijaykerure
Copy link

html2Canvas does not support several modern color functions, leading pdf output to fail when using a few modern UI frameworks such as DaisyUI.

e.g: daisyui@latest uses oklch color function, If we use jsPDF with daisyUI we facing an error Error: Attempting to parse an unsupported color function "oklch"

Also, html2canvas-pro has several advantages over html2canvas, including:

  • support color function color() (including relative colors)
  • support color function lab()
  • support color function lch()
  • support color function oklab()
  • support color function oklch()
  • Support object-fit of <img />
@Juman8
Copy link

Juman8 commented Aug 22, 2024

hi everyone. I am getting error with it.
Are there any current plans to update the library source code?

@Juman8
Copy link

Juman8 commented Oct 8, 2024

Hello, I found a way to fix it.
You just need to remove the html2canvas library and then add html2canvas-pro.
add it to the webpack alias or corresponding configs:

eg:
resolve: { alias: { html2canvas: path.resolve(__dirname, 'node_modules/html2canvas-pro') } },

it's work for me.

@Juman8
Copy link

Juman8 commented Oct 8, 2024

It is the only solution I have found so far.

@humashaaa
Copy link

Hi, @Juman8
I switched to html2canvas-pro already. But where to use this?
resolve: { alias: { html2canvas: path.resolve(__dirname, 'node_modules/html2canvas-pro') } },

@BSoDium
Copy link

BSoDium commented Oct 8, 2024

@humashaaa this looks like a piece of webpack configuration

@Juman8
Copy link

Juman8 commented Oct 9, 2024

Hi, @Juman8 I switched to html2canvas-pro already. But where to use this? resolve: { alias: { html2canvas: path.resolve(__dirname, 'node_modules/html2canvas-pro') } },

it's in the webpack alias section.

@FNERNST
Copy link

FNERNST commented Oct 10, 2024

FYI: also works with the alias section in VITE.

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

5 participants