473,322 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Convert HTML to Image

Dear All Experts

I would like to know how to convert a HTML into Image using C#. Or allow me
contains HTML code (parsed) in Image? I also tried this way but it just
display the character "<" & ">" directly....

I have done googling, but all return shareware. I would like to know how to
programming...but not using shareware...

Thanks all.

Jul 13 '06 #1
6 29392
The closest solution i can think of is to use Office's COM object to convert
html pages to word documents, and then convert the word documents to JPEG(or
other image) files.

However if you or anyone found a better solution, please let me know. I am
fairly interested in this topic too.

Z.
fl*****@gmail.com

"PenguinPig" wrote:
Dear All Experts

I would like to know how to convert a HTML into Image using C#. Or allow me
contains HTML code (parsed) in Image? I also tried this way but it just
display the character "<" & ">" directly....

I have done googling, but all return shareware. I would like to know how to
programming...but not using shareware...

Thanks all.

Jul 13 '06 #2
A browser does exactly what he wants. It converts HTML to an image, which is
painted on the Client rectangle of the browser.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Zhenzhong Xu" <Zh*********@discussions.microsoft.comwrote in message
news:50**********************************@microsof t.com...
The closest solution i can think of is to use Office's COM object to
convert
html pages to word documents, and then convert the word documents to
JPEG(or
other image) files.

However if you or anyone found a better solution, please let me know. I am
fairly interested in this topic too.

Z.
fl*****@gmail.com

"PenguinPig" wrote:
>Dear All Experts

I would like to know how to convert a HTML into Image using C#. Or allow
me
contains HTML code (parsed) in Image? I also tried this way but it just
display the character "<" & ">" directly....

I have done googling, but all return shareware. I would like to know how
to
programming...but not using shareware...

Thanks all.


Jul 14 '06 #3
Dear Kevin

Then how can I capture this image? Which class I should use? Since I am not
expert in this skill...
Thanks

"Kevin Spencer" <uc*@ftc.govwrote in message
news:u4**************@TK2MSFTNGP04.phx.gbl...
A browser does exactly what he wants. It converts HTML to an image, which
is
painted on the Client rectangle of the browser.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Zhenzhong Xu" <Zh*********@discussions.microsoft.comwrote in message
news:50**********************************@microsof t.com...
The closest solution i can think of is to use Office's COM object to
convert
html pages to word documents, and then convert the word documents to
JPEG(or
other image) files.

However if you or anyone found a better solution, please let me know. I
am
fairly interested in this topic too.

Z.
fl*****@gmail.com

"PenguinPig" wrote:
Dear All Experts

I would like to know how to convert a HTML into Image using C#. Or
allow
me
contains HTML code (parsed) in Image? I also tried this way but it just
display the character "<" & ">" directly....

I have done googling, but all return shareware. I would like to know
how
to
programming...but not using shareware...

Thanks all.



Jul 15 '06 #4
I did some research on this and i found a solution which is not particularly
easy to implement, but it is doable.

if you want to do all these programatically, it is not easy.

First of all, you'll need to transform whatever Html you want to a new xhtml
file/stream, (XHTML is a newer generation of html markup stated in XML). Or
you can configure your ASP.Net application to render XHTML content.

Step 2: you'll need to transform XHTML to FO(formating object language)
using a XML Stylesheet (XSL transformation).

Step 3, Convert FO file/stream to a PDF file. You can achieve this step by
using an opensource compiled dll called nfop which is hosted on
sourceforge.net.

Step 4. Convert PDF file/stream to an image file/stream. I am aware there
are some third party API out there for doing this step, but they are not
cheap unless you want to implement your own converter. You can probably skip
this step if you can find an API to convert XSL-FOs to images directly.

So basically, here is the streamline process.

HTML ------->XHTML -----FO ---------PDF ------------JPEG
XSL NFOP Converter

Let me know if you have any questions.

Zhenzhong
fl*****@gmail.com

"PenguinPig" wrote:
Dear Kevin

Then how can I capture this image? Which class I should use? Since I am not
expert in this skill...
Thanks

"Kevin Spencer" <uc*@ftc.govwrote in message
news:u4**************@TK2MSFTNGP04.phx.gbl...
A browser does exactly what he wants. It converts HTML to an image, which
is
painted on the Client rectangle of the browser.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Zhenzhong Xu" <Zh*********@discussions.microsoft.comwrote in message
news:50**********************************@microsof t.com...
The closest solution i can think of is to use Office's COM object to
convert
html pages to word documents, and then convert the word documents to
JPEG(or
other image) files.
>
However if you or anyone found a better solution, please let me know. I
am
fairly interested in this topic too.
>
Z.
fl*****@gmail.com
>
"PenguinPig" wrote:
>
>Dear All Experts
>>
>I would like to know how to convert a HTML into Image using C#. Or
allow
>me
>contains HTML code (parsed) in Image? I also tried this way but it just
>display the character "<" & ">" directly....
>>
>I have done googling, but all return shareware. I would like to know
how
>to
>programming...but not using shareware...
>>
>Thanks all.
>>
>>
>>
>>


Jul 17 '06 #5
the other alternative as Kevin stated is: use some WIN32 API to capture the
browser's window image.

here is a link to a sample project:
http://www.codeproject.com/cs/media/IECapture.asp

of course, using this method means you'll have an instance of browser
running for each convertion process. Thus you probably don't want to do this
if you are planning to implement a web service of some sort.

Z.

"PenguinPig" wrote:
Dear Kevin

Then how can I capture this image? Which class I should use? Since I am not
expert in this skill...
Thanks

"Kevin Spencer" <uc*@ftc.govwrote in message
news:u4**************@TK2MSFTNGP04.phx.gbl...
A browser does exactly what he wants. It converts HTML to an image, which
is
painted on the Client rectangle of the browser.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Zhenzhong Xu" <Zh*********@discussions.microsoft.comwrote in message
news:50**********************************@microsof t.com...
The closest solution i can think of is to use Office's COM object to
convert
html pages to word documents, and then convert the word documents to
JPEG(or
other image) files.
>
However if you or anyone found a better solution, please let me know. I
am
fairly interested in this topic too.
>
Z.
fl*****@gmail.com
>
"PenguinPig" wrote:
>
>Dear All Experts
>>
>I would like to know how to convert a HTML into Image using C#. Or
allow
>me
>contains HTML code (parsed) in Image? I also tried this way but it just
>display the character "<" & ">" directly....
>>
>I have done googling, but all return shareware. I would like to know
how
>to
>programming...but not using shareware...
>>
>Thanks all.
>>
>>
>>
>>


Jul 17 '06 #6
Depending on the context, a WebBrowser Control could be used to do this. If
you create a Control that derives from the WebBrowser Control, you should be
able to override the OnPaint method and pass a Graphics instance to the base
class's OnPaint Method to get it to draw on an image.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Zhenzhong Xu" <Zh*********@discussions.microsoft.comwrote in message
news:6F**********************************@microsof t.com...
>I did some research on this and i found a solution which is not
particularly
easy to implement, but it is doable.

if you want to do all these programatically, it is not easy.

First of all, you'll need to transform whatever Html you want to a new
xhtml
file/stream, (XHTML is a newer generation of html markup stated in XML).
Or
you can configure your ASP.Net application to render XHTML content.

Step 2: you'll need to transform XHTML to FO(formating object language)
using a XML Stylesheet (XSL transformation).

Step 3, Convert FO file/stream to a PDF file. You can achieve this step
by
using an opensource compiled dll called nfop which is hosted on
sourceforge.net.

Step 4. Convert PDF file/stream to an image file/stream. I am aware there
are some third party API out there for doing this step, but they are not
cheap unless you want to implement your own converter. You can probably
skip
this step if you can find an API to convert XSL-FOs to images directly.

So basically, here is the streamline process.

HTML ------->XHTML -----FO ---------PDF ------------JPEG
XSL NFOP Converter

Let me know if you have any questions.

Zhenzhong
fl*****@gmail.com

"PenguinPig" wrote:
>Dear Kevin

Then how can I capture this image? Which class I should use? Since I am
not
expert in this skill...
Thanks

"Kevin Spencer" <uc*@ftc.govwrote in message
news:u4**************@TK2MSFTNGP04.phx.gbl...
A browser does exactly what he wants. It converts HTML to an image,
which
is
painted on the Client rectangle of the browser.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Zhenzhong Xu" <Zh*********@discussions.microsoft.comwrote in message
news:50**********************************@microsof t.com...
The closest solution i can think of is to use Office's COM object to
convert
html pages to word documents, and then convert the word documents to
JPEG(or
other image) files.

However if you or anyone found a better solution, please let me know.
I
am
fairly interested in this topic too.

Z.
fl*****@gmail.com

"PenguinPig" wrote:

Dear All Experts

I would like to know how to convert a HTML into Image using C#. Or
allow
>me
contains HTML code (parsed) in Image? I also tried this way but it
just
display the character "<" & ">" directly....

I have done googling, but all return shareware. I would like to know
how
>to
programming...but not using shareware...

Thanks all.




Jul 18 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: kevin bailey | last post by:
this old script was written when register globals was 'on'. now i need to convert it to run on a server with a php 4.3.6 - do i just convert the relevant variables from $posted_variable to...
3
by: hycn office | last post by:
hi everyone, i am using win2k server and asp i am trying to convert html to pdf or image instantly on my web site. desperately, i am using web hosting and i cant install any component. ...
4
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
5
by: Carl Gilbert | last post by:
Hi I have some ASP code that I want to run from CD within a VB.NET windows application with a web browser control. However, to get the ASP pages to run without a server is proving quite...
0
by: Zhao Sheng | last post by:
http://www.guangmingsoft.com/htmltoimage/help.htm Html To Image Html To Image 2.0 Released! Html To Image help you convert html page from any URL to image or thumbnails easily and quickly. ...
2
by: James dean | last post by:
Do i have to create an index pallette. How do i do that?. Or, Can i not just make an ordinary 8pp pixel format without this indexed problem...... *** Sent via Developersdex...
3
by: dale zhang | last post by:
Hi, I am trying to read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp The article author is using PictureBox for windows...
26
by: mark | last post by:
The idea of this is very simle. The site is 800px wide and sits in the middle of the browser window, on either side of the site I want a different background image aligned against it. If I were...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.