vercel / satori

Enlightened library to convert HTML and CSS to SVG
https://og-playground.vercel.app
Mozilla Public License 2.0
11k stars 242 forks source link

Image not rendered inside PDF (satori + PDFKit) #269

Open harish-sethuraman opened 1 year ago

harish-sethuraman commented 1 year ago

Bug report

Description / Observed Behavior

image not rendered inside PDF (satori + PDFKit) got this in console

SVGElemImage: failed to open image "data:image/svg+xml;utf8,%3Csvgfill=%22%23000%22xmlns=%22http://www.w3.org/2000/svg%22viewBox=%22007565%22width=%2275%22height=%2265%22%3E%3Cpathd=%22M37.59.25l36.9564H.64l36.95-64z%22%3E%3C/path%3E%3C/svg%3E" in PDFKit
Screenshot 2022-10-28 at 11 49 53 AM

Expected Behavior

The image should have rendered

How did you expect Satori to behave here?

Reproduction

Go to https://og-playground.vercel.app/ and click on PDF preview

styfle commented 1 year ago

This is a known bug: svg is not supported by pdf kit

See https://github.com/vercel/satori/pull/118#issuecomment-1238215272 for more details.

We should probably change the playground example to avoid this bug.

harish-sethuraman commented 1 year ago

We should probably change the playground example to avoid this bug.

True. I thought it was a error by opening the console. I'd be happy to send a fix if any.

shuding commented 1 year ago

I'm thinking about making a better PDF solution with probably https://github.com/typst/svg2pdf, while this one in the playground is more like a quick proof of concept.