satori icon indicating copy to clipboard operation
satori copied to clipboard

Image not rendered inside PDF (satori + PDFKit)

Open harish-sethuraman opened this issue 3 years ago • 3 comments

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

harish-sethuraman avatar Oct 28 '22 06:10 harish-sethuraman

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.

styfle avatar Oct 28 '22 16:10 styfle

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.

harish-sethuraman avatar Oct 28 '22 17:10 harish-sethuraman

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.

shuding avatar Oct 29 '22 00:10 shuding