Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

save/export image file from html content?

I have a scenario that, I am creating dynamic html content and I need to export/save the html content to an image file with php, jQuery and JavaScript [or with any other if possible].

like image 931
Bhavin Rana Avatar asked Jan 31 '12 07:01

Bhavin Rana


People also ask

How do I export an image from HTML?

Choose File > Export and select HTML from the Save As Type list. Specify the name and location of the HTML document, and then click Save. In the HTML Export Options dialog box, specify the desired options in the General, Image, and Advanced areas, and then click OK.

How do I export from HTML?

HTML Export OptionsChoose the HTML as the Export To and one of the following options to export your website's HTML. The Folder is the default option for the Export of the HTML code. You can also export your website's HTML as a ZIP file. Or upload your HTML site via FTP.


1 Answers

You can draw the html onto a canvas. https://developer.mozilla.org/en/HTML/Canvas/Drawing_DOM_objects_into_a_canvas

and then save the canvas as an image to the server. http://motyar.blogspot.com/2010/04/save-html5-canvas-data-as-image.html

Or send the html to the server and render it server-side:

https://github.com/visionmedia/screenshot-app or http://cutycapt.sourceforge.net/

like image 72
Mario Michelli Avatar answered Oct 21 '22 11:10

Mario Michelli