473,750 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capture an HTML document as an image

I need a working example of code to do this or some specific pointers
with the code below. I can provide more of the surrounding code block
if necessary.

I need my Application to be able to create a full page image of a
given web page. This will be used to perform a fax. I have located
several articles about this giving sample code using shdocvw.WebBrow ser
to navigate to the target html and then grabbing the render object to
paint onto the device context of our choice.
ex.:
http://dotnetjunkies.com/WebLog/alan.../25/70496.aspx
http://blogs.msdn.com/rfarber/archiv...12/240943.aspx

I am currently attempting to use this method, but my problem is that I
can't get a valid IHTMLElementRen der object so i can perform the
render.
It gives me an invalidcastexce ption. The (correctly?) implemented
fixes recommended in the rfarbers article aren't resolving the issue.

Here's the offending line:
Dim render As IHTMLElementRen der = CType(elmnt, IHTMLElementRen der)

Thanks for your help.

kelly

(Any VB or C# responses are welcome, WinForms or Web.
However, my app is a web app.)

Please pardon the cross post. I posted this question in another forum
but am not getting any
responses and my deadline is quickly approaching.

Feb 21 '06 #1
4 4232
Hi Kelly,

IECapt.exe may bypass the whole problem for you. Please look into whether it
will play as an alternative.

Best regards,
-- Li-fan

<ke************ @hotmail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
I need a working example of code to do this or some specific pointers
with the code below. I can provide more of the surrounding code block
if necessary.

I need my Application to be able to create a full page image of a
given web page. This will be used to perform a fax. I have located
several articles about this giving sample code using shdocvw.WebBrow ser
to navigate to the target html and then grabbing the render object to
paint onto the device context of our choice.
ex.:
http://dotnetjunkies.com/WebLog/alan.../25/70496.aspx
http://blogs.msdn.com/rfarber/archiv...12/240943.aspx

I am currently attempting to use this method, but my problem is that I
can't get a valid IHTMLElementRen der object so i can perform the
render.
It gives me an invalidcastexce ption. The (correctly?) implemented
fixes recommended in the rfarbers article aren't resolving the issue.

Here's the offending line:
Dim render As IHTMLElementRen der = CType(elmnt, IHTMLElementRen der)

Thanks for your help.

kelly

(Any VB or C# responses are welcome, WinForms or Web.
However, my app is a web app.)

Please pardon the cross post. I posted this question in another forum
but am not getting any
responses and my deadline is quickly approaching.

Feb 22 '06 #2
Thanks for the response Li-fan,

I did look at IECapt, but I have some constraints which make that
solution difficult:
1.) the target web page is behind a login page, which means we cannot
just pass IECapt a url, but will need to pass it raw html.
2.) the application is a web app, which means that the solution needs
to be thread safe.

I would peer into the IECapt code for some techniques, but it is a C++
application, and my final deliverables need to be VB.NET.

Feb 22 '06 #3
Is this the only option ? I used once a fax solution that was able to
convert from several formats including basic HTML...

--
Patrice

<ke************ @hotmail.com> a écrit dans le message de
news:11******** *************@f 14g2000cwb.goog legroups.com...
I need a working example of code to do this or some specific pointers
with the code below. I can provide more of the surrounding code block
if necessary.

I need my Application to be able to create a full page image of a
given web page. This will be used to perform a fax. I have located
several articles about this giving sample code using shdocvw.WebBrow ser
to navigate to the target html and then grabbing the render object to
paint onto the device context of our choice.
ex.:
http://dotnetjunkies.com/WebLog/alan.../25/70496.aspx
http://blogs.msdn.com/rfarber/archiv...12/240943.aspx

I am currently attempting to use this method, but my problem is that I
can't get a valid IHTMLElementRen der object so i can perform the
render.
It gives me an invalidcastexce ption. The (correctly?) implemented
fixes recommended in the rfarbers article aren't resolving the issue.

Here's the offending line:
Dim render As IHTMLElementRen der = CType(elmnt, IHTMLElementRen der)

Thanks for your help.

kelly

(Any VB or C# responses are welcome, WinForms or Web.
However, my app is a web app.)

Please pardon the cross post. I posted this question in another forum
but am not getting any
responses and my deadline is quickly approaching.

Feb 22 '06 #4
Thanks for the suggestion, I can Google for 3rd parties. But due to
customer & project constraints I am most likely constrained to thier
current, non thread safe, print driver solution, or the prefered
GDI/GDI+ solution.

Using GDI and GDI+ to natively grab the image is strongly prefered,
especially since others have posted great success getting this to work,
and I seem to only have this one roadblock.

Additionally, most 3rd party solutions appear to be cludging together
print driver solutions which bring other issues to the table.

Feb 22 '06 #5

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

Similar topics

2
4803
by: Larry Cheung | last post by:
I want to write a program to monitor each local printer When a print job is sending to a printer this program could be fired and capture the printed content as an image. It is easy to use API function FindNextPrinterChangeNotification() to get information such as TotalPages, TotalBytes, FileName, etc, but I have no idea how to capture the printed ontent, anyone could help? Many thanks!! Larry
4
14727
by: Jay | last post by:
Hi, How can I capture mouse position on Image? I found number of script capturing mouse position of the page. But I could not find anything based on image. What I want to find out is X Y coordinates of mouse position. based on left of the top of my image is 0 0 (X Y coordinates) otherwise, I need to find out position of my image so I can calculate.
9
2896
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 no luck though), and searched through the IRT.ORG Faqs (www.irt.org/script/script.htm). The Javascript is designed to open an popup window and then inside that window call another script which will resize that window. There may be another...
1
1739
by: ddd | last post by:
I am trying to build a VB.net application that converts an html file (grabbed of a user specified url) into an image. I found out the following article on the web which explains how to do it using C++: http://www.codeproject.com/internet/htmlimagecapture.asp However, I do not understand C++ at all and I am having a tough time using GDI+. All I have figured out up to now is how to use MSHTML to load the html of a URL. Can someone help me...
1
1861
by: amit | last post by:
Hello, I saw on an article that you can capture an image like: ****************** from here ******************* Consider the following HTML definition: <IMG SRC="anything.gif" NAME="anything" HEIGHT="100" WIDTH="100">
1
2456
by: Mentat | last post by:
In the description below ??? marks specific problem areas. Any help is appreciated. Required ======== A method to detect the width and height values of a <DIV... element. Since there are two ways to "style" a DIV, it should be noted that a CSS file is used in this case. The same is required for an <IMG... element contained within the DIV.
6
7238
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to display an image. document.images only seems to reference image tags. The collection needs to include background images, input type = image, image maps, css assigned background, etc. Honestly, I am probably not aware of all the possibilities...
1
2445
by: rfhall50 | last post by:
I have in place a Security Gate Access application that is up and running. What I would like to add is a camera feature. The way it would work is as follows: Assumed: Camera is already running and pointed at entrance to gate where visitors stop. Whatever the camera sees is in a window somewhere on the screen. Upon guest arrival: 1) Guest announces themselves. 2) We verify they are already on the expected...
1
2770
by: destiny007 | last post by:
can any one help me to write code to capture selected text from a page but problem is that i am not able to decide where to call the functio.in this case the function is called in all cases of mouse out. here is the code <html> <HEAD> <SCRIPT LANGUAGE="JavaScript"> var captured = ""; function captext() {
4
3518
by: mbatestblrock | last post by:
I hope this makes some sense. My ultimate goal here is to execute a block of code if the mouse has not moved in a minute or so within the broswer. The machine I am running this on is for internal use only, so I have no fear of this not working in certain browsers, etc. I am no javascript pro but know enough to catch on if anyone is kind enough to help me out here. One of the only ways I could see this working is by having js check the...
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9394
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.