1

I'm trying to find a way to convert a part of a webpage in an image: I have a dynamically created page, and I would like to "save" a part of it, in an image format.

I know that turning html to image is quite complicated, and could be done by server-side computation with tools like phantom js or other webkit render engine. But I'm trying to find a way to achieve this in client side.

I imagine something like putting the dom elements in a svg (with foreignObject), then rendering the svg in a canvas, and then turning the canvas to base64 string url. But I tried, and I didn't manage to do it.

What do you think about this idea? does it sound possible? I think I first have a way to compute the dom elements css styles in an html string, but that seems very complicated. I guess I need some advice here.

Naftali
  • 144,921
  • 39
  • 244
  • 303
Sebastien C.
  • 2,099
  • 17
  • 21

0 Answers0