0

I have an HTML which contains images and javascript charts. I want to convert that HTML into an image and send as an attachment through email.

Is it possible?

If yes, which library should I use for this task?

GYaN
  • 2,327
  • 4
  • 19
  • 39
  • 1
    Take screenshot of your screen and then attach it in your email. For screenshot use Html2canvas. "https://github.com/niklasvh/html2canvas". – Salman Ahmed Nov 22 '17 at 10:49
  • possibility duplicate: https://stackoverflow.com/questions/2651173/rendering-html-to-png-server-side – Vahid Nov 22 '17 at 10:50
  • Possible duplicate of https://stackoverflow.com/questions/10721884/render-html-to-an-image – Naveen Nov 22 '17 at 11:00

1 Answers1

0

Yes it's possible, but for that you need to use phantomjs. Here is a php library i used for phantomjs. http://jonnnnyw.github.io/php-phantomjs/

Its pure php solution (using phantomjs browser) and is very easy to use. Just install this library through composer and that's it you should be good to go.

Note: This solution is valid if you want to take screenshot of your html page through its URL.

Hope it helps :-)

Community
  • 1
  • 1
Osama Sheikh
  • 994
  • 1
  • 11
  • 15