html2pdf.js icon indicating copy to clipboard operation
html2pdf.js copied to clipboard

Issue "Attempting to parse an unsupported color function "oklch"

Open chiendao1808 opened this issue 1 year ago • 5 comments

This error occurs when i am using html2pdf lib ver 0.10.2 to convert html content into a pdf file (Chrome 131.0.6778.205 and Edge). Please give me a solution, thanks you! image image

chiendao1808 avatar Dec 21 '24 04:12 chiendao1808

look it https://github.com/niklasvh/html2canvas/issues/2700

027xiguapi avatar Dec 23 '24 07:12 027xiguapi

The same :(

minhtq13 avatar Jan 04 '25 12:01 minhtq13

This error occurs when i am using html2pdf lib ver 0.10.2 to convert html content into a pdf file (Chrome 131.0.6778.205 and Edge). Please give me a solution, thanks you! image image

Look into 👉 https://github.com/niklasvh/html2canvas/issues/2700#issuecomment-2781596537

SwapnilBhattacharya05 avatar Apr 06 '25 19:04 SwapnilBhattacharya05

To add to @027xiguapi and @SwapnilBhattacharya05 comments, here's a summary of how I addressed this in a project setup with Quasar/Vite:

  1. Removed html2canvas and added html2canvas-pro

  2. Added a custom alias to ensure html2pdf.js imports from html2canvas-pro instead of html2canvas:

// quasar.config.ts
extendViteConf(viteConf) {
  // ...

  viteConf.resolve = viteConf.resolve || {}
  viteConf.resolve.alias = {
    ...viteConf.resolve.alias,
    html2canvas: resolve(import.meta.dirname, 'node_modules/html2canvas-pro'),
  }
  
  // ...
}

gasscoelho avatar Aug 06 '25 16:08 gasscoelho

i handle this issue with this steps

  • using html2canvas-pro to convert the element into image
  • use pdfjs to convert it into pdf after take it from html2canvas-pro

and the result so good

zetaxalhaffar avatar Oct 07 '25 12:10 zetaxalhaffar