Aymkdn / html-to-pdfmake

This module permits to convert HTML to the PDFMake format
https://aymkdn.github.io/html-to-pdfmake/index.html
MIT License
545 stars 88 forks source link

Treat <canvas> as an Image #186

Closed GameDungeon closed 1 year ago

GameDungeon commented 1 year ago

Treating canvas elements as images would allow dynamic js generated images as a way to make up for how more complex HTML isn't possible in PDFMake.

I would provide an example for your renderer, but it does not support JS, which is needed to draw onto the canvas.

It is rather simple to extract the image form a canvas as can be seen here.

Aymkdn commented 1 year ago

That doesn't seem that simple.... Did you check other projects? None is doing it?

And yes, please provide examples.

GameDungeon commented 1 year ago

I have some time today, and I was going to do a PR. There is one issue with this idea. You need an actual reference to the canvas object instead of just a string as you can have with everything else. Figuring out that, I could make a PR.

GameDungeon commented 1 year ago

I ended up doing this on my end. I realize this is a bit out of scope for this lib.