473,385 Members | 1,379 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,385 software developers and data experts.

html to image

Hi all.
My goal is to convert html elements to bitmap.
So the first step would be to parse the html.
System.Windows.Forms.WebBrowser even has a method called DrawToBitmap,
which makes the whole thing much easier.
The problem is that WebBrowser cannot be used in a dll.
I can understand why WebBrowser is in System.Windows.Forms namespace,
but i don't understand how classes like HtmlElement belong to
System.Windows.Forms.
So my questions are:
1. is there a way to use WebBrowser in a console application or dll?
2. why is there no separation between the visual control and the parser?
Thanks.
Sharon.
Nov 17 '05 #1
6 4571
Sharon,

Instead of doing it yourself, you can have the operating system do it
for you. There is an interface in COM called IExtractImage which
implementations will use to create thumbnail images. All you have to do is
specify the size of the image you want to render and then make the call to
Extract.

There is an article on vbaccelerator.net titled "Thumbnail Extraction
Using the Shell", located at (watch for line wrap):

http://www.vbaccelerator.com/home/NE...on/article.asp

This should tell you all you need to know.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ca*******@caspershouse.com

"Sharon" <no**@null.void> wrote in message
news:Oa**************@TK2MSFTNGP09.phx.gbl...
Hi all.
My goal is to convert html elements to bitmap.
So the first step would be to parse the html.
System.Windows.Forms.WebBrowser even has a method called DrawToBitmap,
which makes the whole thing much easier.
The problem is that WebBrowser cannot be used in a dll.
I can understand why WebBrowser is in System.Windows.Forms namespace,
but i don't understand how classes like HtmlElement belong to
System.Windows.Forms.
So my questions are:
1. is there a way to use WebBrowser in a console application or dll?
2. why is there no separation between the visual control and the parser?
Thanks.
Sharon.

Nov 17 '05 #2
Thanks Nicholas for your reply.
I will try your suggestion, but i doubt it can help me
as i need to render segments of the html doc.
I'm really frustrated by the fact, that there is no
stand alone html dom parser in the framework.
There is one, but it is bundled in the WebBrowser control.
Sharon.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Of**************@TK2MSFTNGP12.phx.gbl...
Sharon,

Instead of doing it yourself, you can have the operating system do it
for you. There is an interface in COM called IExtractImage which
implementations will use to create thumbnail images. All you have to do is specify the size of the image you want to render and then make the call to
Extract.

There is an article on vbaccelerator.net titled "Thumbnail Extraction
Using the Shell", located at (watch for line wrap):

http://www.vbaccelerator.com/home/NE...on/article.asp
This should tell you all you need to know.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ca*******@caspershouse.com

"Sharon" <no**@null.void> wrote in message
news:Oa**************@TK2MSFTNGP09.phx.gbl...
Hi all.
My goal is to convert html elements to bitmap.
So the first step would be to parse the html.
System.Windows.Forms.WebBrowser even has a method called DrawToBitmap,
which makes the whole thing much easier.
The problem is that WebBrowser cannot be used in a dll.
I can understand why WebBrowser is in System.Windows.Forms namespace,
but i don't understand how classes like HtmlElement belong to
System.Windows.Forms.
So my questions are:
1. is there a way to use WebBrowser in a console application or dll?
2. why is there no separation between the visual control and the parser?
Thanks.
Sharon.


Nov 17 '05 #3

Sharon wrote:
Hi all.
My goal is to convert html elements to bitmap.
So the first step would be to parse the html.


Well, that's debatable, but...

A great library for dealing exactly this problem is HtmlAgilityPack. It
will convert even 'real world' (ie non-strict) html into a nice tidy
DOM.

--
Larry Lard
Replies to group please

Nov 17 '05 #4
"Larry Lard" <la*******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Sharon wrote:
Hi all.
My goal is to convert html elements to bitmap.
So the first step would be to parse the html.
Well, that's debatable, but...


How can you render un parsed html?

A great library for dealing exactly this problem is HtmlAgilityPack. It
will convert even 'real world' (ie non-strict) html into a nice tidy
DOM.

--
Larry Lard
Replies to group please

Nov 17 '05 #5

Sharon wrote:
"Larry Lard" <la*******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Sharon wrote:
Hi all.
My goal is to convert html elements to bitmap.
So the first step would be to parse the html.


Well, that's debatable, but...


How can you render un parsed html?


By passing it to a component that does both the parsing and the
rendering!

--
Larry Lard
Replies to group please

Nov 17 '05 #6

"Larry Lard" <la*******@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

Sharon wrote:
"Larry Lard" <la*******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Sharon wrote:
> Hi all.
> My goal is to convert html elements to bitmap.
> So the first step would be to parse the html.

Well, that's debatable, but...
How can you render un parsed html?


By passing it to a component that does both the parsing and the
rendering!


Yes, i was hoping to use the WebBrowser class, but can do that only in
windows forms.

--
Larry Lard
Replies to group please

Nov 17 '05 #7

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

Similar topics

14
by: Gregory | last post by:
Hello, I'm trying to do the above in order to process an image and return the result to an html image control. It fails and my key suspects are either the variable that I'm passing in -...
1
by: no one | last post by:
I have been searching various boards trying to figure out how to generate an image along with other html. I intend to put the image in a table, but for now I am just having problem getting the...
0
by: SteveJ | last post by:
All, Can someone help me solve the next step. First of all let me say I'm new to php. I pieced the following code together from samples I found on the net and a book I bought called PHP...
9
by: Robby Bankston | last post by:
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with...
33
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show...
7
by: Ubantu Rococo | last post by:
Hi all, Sorry for this stupid question, but I am having trouble mixing imagecopy etc. with HTML. What I am trying to do is copy an image, and then obtain co-ordinates from a database which will...
6
by: PenguinPig | last post by:
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 "<" &...
6
by: lilcech | last post by:
How can i cobine my image with a html file so i only have one file. The image is used inside the html file so if i delete it or move it, then it wont show up in the html file. :)
7
by: Xah Lee | last post by:
Summary: when encountering ex as a unit in css, FireFox (and iCab) did not take into account the font-family. Detail: http://xahlee.org/js/ff_pre_ex.html Xah xah@xahlee.org ∑...
9
by: boycey | last post by:
Hi I have tried to embed a simpleviewer gallery (which works fine as a standalone web page) into a table on an existing web page inorder to show it as a gallery window. The gallery loads but there...
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...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.