sidebase / nuxt-pdf

📄 A easy to use, pdf exporting module to convert Nuxt 3 components into downloadable PDFs.
MIT License
119 stars 9 forks source link

Exporting PDF using DaisyUI #23

Open hylink-carlos-nieto opened 10 months ago

hylink-carlos-nieto commented 10 months ago

Environment

No response

Reproduction

No response

Describe the bug

I'm trying to export a pdf using this module in a project with DaisyUI, but I'm getting the attached error. Apparently it doesn't load correctly the oklch variables from Daisy. Thank you in advance if someone can help me with this.

Screenshot 2024-01-31 at 6 18 32 PM

Additional context

No response

Logs

No response

frantortosa commented 7 months ago

Hello, I have the same bug,

Error: Attempting to parse an unsupported color function "oklch" at Object.parse (html2canvas.esm.js?v=57a7160c:1720:23)

I had no idea it was related to DaisyUI but yes, I also use DaisyUI. Any potential solution for this?

Thanks!

ichsanmln99 commented 6 months ago

i have same problem

Uncaught (in promise) Error: Attempting to parse an unsupported color function "oklch"

any update?

Nebual commented 6 months ago

This seems to be a limitation of the underlying html2canvas library (used by jspdf, which nuxt-pdf uses), there's several issues (https://github.com/niklasvh/html2canvas/issues/3130, https://github.com/niklasvh/html2canvas/issues/3150, https://github.com/niklasvh/html2canvas/issues/2700) mentioning it but the library seems to be unmaintained for the last 2 years.

Each issue has a comment from the author of a fork https://www.npmjs.com/package/html2canvas-pro saying theirs supports oklch, but the fork's git repo only has 2 commits (so the oklch support has been blended into its 'initial commit') which doesn't bode well for longterm success of that fork. Theres another fork that looks to be more open source friendly, but at a glance it doesn't look like it supports oklch yet.

I'm unsure how this package might do much about this, but I'm personally going to look into using Puppeteer for serverside pdf generation instead.