Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / September 2005



Tip: Looking for answers? Try searching our database.

How can I convert HTML page to an image(gif, jpg)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rava - 19 Sep 2005 18:29 GMT
Hi,
Does anyone know how to retrieve a web page as an image (not get an
image from a web page)? I need to convert HTML page to an image(gif,
jpg) and can't seem to find any code or hints on how to do
this.
I'm using VB6 or vbscript/asp.
Thanks!
Someone - 20 Sep 2005 05:31 GMT
One way:

Start by using "Microsoft Internet Controls" componenet. After you display
the page, use WebBrowser1.hWnd and BitBlt API function to copy the contents
to a PictureBox.

See these articles for samples that use BitBlt:

http://support.microsoft.com/default.aspx?scid=kb;en-us;147810
http://support.microsoft.com/default.aspx?scid=kb;en-us;161299

BitBlt requires hDC of the browser to work. Use GetDC(WebBrowser1.hWnd) API
function to get it. Don't forget to use ReleaseDC in the same routine when
you are done with it. Use error trapping and release it to prevent memory
leaks.

If the page is too long, I am not sure how you could scroll it by certain
number of pixels and take snapshots and attach them to each other. However,
at runtime, you could set the hight too long, longer than the form itself,
but I am not sure what the result would be.

As for the PictureBox, you could make it invisible and set AutoRedraw to
True, however, make it big enough to hold the entire image.

Good luck!

> Hi,
> Does anyone know how to retrieve a web page as an image (not get an
[quoted text clipped - 3 lines]
> I'm using VB6 or vbscript/asp.
> Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.