Leroy Mikenzi
Leroy Mikenzi

Reputation: 810

how to convert HTML file to a image file

I have a letterhead made using HTML, I want to convert it to an image how can it be done . And I want to use it my site,i.e when the user clicks on the SUBMIT button it should convert it in the background....

Upvotes: 2

Views: 1853

Answers (3)

notajoke
notajoke

Reputation: 33

You can use javascript library called html2canvas this library can convert a specific object in html (it might be block, table, etc) into a image with .png extension.

https://html2canvas.hertzen.com/

Upvotes: 0

starbeamrainbowlabs
starbeamrainbowlabs

Reputation: 6116

If you are using PHP, then you could look here:

https://stackoverflow.com/questions/1963900/php-library-for-converting-html-to-image

There are several solutions to the problem there.

You can have your script send the HTML to the server when the user clicks 'submit', and then return the result. Most of the solutions are quite fast I should have thought, depending on the complexity of the HTML to be converted....

Upvotes: 0

Yasir Mahmood
Yasir Mahmood

Reputation: 354

You can use VBScript to convert your HTML page into image

Dim snap

'Create the Html Snapshot Object
Set snap = CreateObject("HTMLSNAP2.HtmlSnap.1")

'Begin to capture the web page
snap.SnapUrl "http://www.google.com/", "google.jpg"

Upvotes: 0

Related Questions