Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

html to image

124 views
Skip to first unread message

Sharon

unread,
Sep 11, 2005, 5:20:07 AM9/11/05
to
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.


Nicholas Paldino [.NET/C# MVP]

unread,
Sep 11, 2005, 10:29:56 AM9/11/05
to
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/NET/Code/Libraries/Shell_Projects/Thumbnail_Extraction/article.asp

This should tell you all you need to know.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- casp...@caspershouse.com

"Sharon" <no...@null.void> wrote in message
news:Oa6Ydlqt...@TK2MSFTNGP09.phx.gbl...

Sharon

unread,
Sep 13, 2005, 7:31:43 AM9/13/05
to
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]" <m...@spam.guard.caspershouse.com> wrote in
message news:OfD2H1tt...@TK2MSFTNGP12.phx.gbl...

Larry Lard

unread,
Sep 13, 2005, 6:58:12 AM9/13/05
to

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

Sharon

unread,
Sep 13, 2005, 8:17:36 AM9/13/05
to
"Larry Lard" <larr...@hotmail.com> wrote in message
news:1126609092.7...@z14g2000cwz.googlegroups.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?

Larry Lard

unread,
Sep 13, 2005, 7:22:05 AM9/13/05
to

Sharon wrote:
> "Larry Lard" <larr...@hotmail.com> wrote in message
> news:1126609092.7...@z14g2000cwz.googlegroups.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!

Sharon

unread,
Sep 13, 2005, 10:33:47 AM9/13/05
to

"Larry Lard" <larr...@hotmail.com> wrote in message
news:1126610525.2...@g47g2000cwa.googlegroups.com...

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

0 new messages