Producing an image from HTML.

U

UJ

I've got some HTML that produces what I need. I need to make an image of it
to display on pages of my web site (I won't go in to why - just trust me - I
need the image of it). The user enters some stuff that can include HTML code
that I need to convert on the fly behind the scenes.

Is there any way to take HTML and produce an image of what it looks like
programmatically?

TIA - J.
 
G

George

Not a trivial task.

There are couple ready solutions for that.
http://www.imgmaker.com/


George.



I've got some HTML that produces what I need. I need to make an image of it
to display on pages of my web site (I won't go in to why - just trust me - I
need the image of it). The user enters some stuff that can include HTML code
that I need to convert on the fly behind the scenes.

Is there any way to take HTML and produce an image of what it looks like
programmatically?

TIA - J.
 
K

Kevin Spencer

Hi Clinton,

Google "screen scrape".

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
I'd rather be a hammer than a nail.
 
U

UJ

When I do the Google search, the first 50 or so all appear to be how to get
the html from a web page into a string. I need an actual image of the
resulting html not the code of it.

Thanks anyway.
 
K

Kevin Spencer

Well, you could take Juan's advice, or find another ready-made component. I
did some research, and it is possible, but not easy or simple to do. It
would require some Interop. I found a COM Library
(C:\WINDOWS\System32\shdocvw.dll). The title of this library is "Microsoft
Internet Controls." It is the COM interface to Microsoft Internet Explorer.
It has several objects in it for browsing and displaying HTML documents, in
particular the "InternetExplorer" object, and the "WebBrowser" object.

A bit more research into the MSDN Library revealed that both of these
objects expose a HWND property, which is a handle to the window. I believe
the WebBrowser component is the one you want to use. You would use the
Navigate method to navigate the WebBrowser to the URL, and use the
System.Drawing.Graphics.FromHwnd() method to get a Graphics object from the
Window handle. From there it should be relatively easy to draw the contents
of the window in a bitmap, manipulate it, and display it in an ASP.Net page
as a thumbnail or what-have-you.

Again, as I haven't done this, there are no doubt a few surprises along the
way. But if you're brave, you can give it a try.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
I'd rather be a hammer than a nail.
 
C

clintonG

Hello - my earlier reply to "screen scrape" has not been posted. OE remnants
perhaps. Anyhow, I appreciate comments as I want to get something like this
topic discusses done some time in the near future. No time today though so
sorry to be so brief but I wanted to note I've tried to replier earlier...

<%= Clinton Gallagher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top