 |
|
 |
Running both of the projects supplied, without any changes, causes the same effect: I can see the full height of the CodeProject web site, but it is very skinny. You can just about see half of the "W" in "Welcome to the Code Project".
Any idea why the width is so small?
Also, is there a way to capture an existing IE browser window instead of opening a new one and navigating to a site? My project needs that ability. Can anybody suggest code to do that?
Thanks...
|
|
|
|
 |
|
 |
I figured out one way to fix this (sort of):
In the GetImage method, I added "* 15" to the statement which sets the scroll width.
I have no idea whether that is a good way to fix this or not.
Still, question remains:
Can somebody help a newbie to adapt this code to use an existing IE window instead of a browser control on a form?
I have an existing ASP.NET application which opens up a print preview browser window containing all information that they had entered in the application. I need to capture the entire print preview into an image file of some type.
If this can be adapted to an open IE window, that would solve my problem. The only identifying characteristic is that the window title is "Print Preview - Windows Internet Explorer" I THINK I can use the FindWindow API to get that browser window, but not sure how. Can the code from this article apply to a .NET WebBrowser object rather than a browser control on a windows form?
Thanks
|
|
|
|
 |
|
 |
Hi,
Nice project, but sadly doesn't work with pages that have a lot of script or Active X controls. I haven't found one free control that can do this, so you're not on your own.
To prove, try capturing yahoo.com
Cheers,
Steve
There are 10 types of people in this world. Those that understand binary, and those that don't.
|
|
|
|
 |
|
 |
I've been working on a similar project, and have found a couple of solutions. But neither of them is 100% reliable.
Problem #1: WebBrowser.DrawToBitmap
Fails to render bitmap for some sites (yahoo, paypal, etc.) This is a known problem, which Microsoft says it will not fix because DrawToBitmap is not actually a public member of the bitmap class.
Therefore, DrawToBitmap is not a viable solution for a commercial-level product.
Problem #2: Graphics.CopyFromScreen
This method works great for creating Thumbnails, but it is not capable of capturing full-sized screenshots. CopyFromScreen will only capture the content which is visible on the screen. If the page requires scrolling, or is partially obscured it will not render that portion of the image.
At this point, I'm looking into a solution that implements the appropriate WIN32 API calls, as the .net framework doesn't seem to have the power to accomplish this task in a reliable fashion.
|
|
|
|
 |
|
 |
Thanks for the superb code. I was trying to figure out on how to go about breaking into multiple pages for TIFF if my HTML source detects a <br style="page-break-before: always;" />
Thanks in advise.
|
|
|
|
 |
|
 |
I am using visual basic 6 and I need a way to read internet explorer text or word text or any text that drawn on the forms with TextOut od vb labels
and many thanks to the replyers and the developers of the site
-------
Sorry for my English I am not English man
|
|
|
|
 |
|
 |
This is great but can it be integrated to a web page?
like a button with a define path... to save the page as image?
|
|
|
|
 |
|
 |
it creats a image file of small html page. but when the file is very big its create half black screen. can u help me out.
gtytjuyju
|
|
|
|
 |
|
 |
I need to convert html to image. I tried your code .Its working properly.
Thank you so much for providing this helpful code.
I am trying to develop the same in C#.net Web Application. If you have any suggessions or hints ,plz help me...
Thanks...
|
|
|
|
 |
|
 |
I am using parts of your code in an application to create a powerpoint presentation. When I run your code and my code the height of the documents aren't the same. In my code it is smaller which cuts off the picture, in your code it doesn't. I've set a breakpoint at:
scrollHeight = formDefault.WebBrowser1.Document.Body.ScrollRectangle.Height and
scrollWidth = formDefault.WebBrowser1.Document.Body.ScrollRectangle.Width.
I am stumped as to why in different apps the height comes up different, thought the widths are the same. I've gone through both pieces of code and stepped through and can't seem to find anything different. Would you happen to have any ideas?
thanks,
jeff.
|
|
|
|
 |
|
 |
I have been Googling all morning for something like this! Great Work, simple to use, and absolutely fantastic job!
|
|
|
|
 |
|
 |
I am using:
---
OS: Vista Business 2GB RAM
VS: Microsoft Visual Studio 2005 Version 8.0.50727.867 (vsvista.050727-8600)
Microsoft .NET Framework Version 2.0.50727
Installed Edition: Professional Version 8.0.50727.867
---
I get this error:
----
System.InvalidCastException was unhandled
Message="Conversion from string "" to type 'Boolean' is not valid."
Source="Microsoft.VisualBasic"
StackTrace:
at Microsoft.VisualBasic.CompilerServices.Conversions.ToBoolean(String Value)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToBoolean(Object Value)
at WebCapture.formDefault.formDefault_Load(Object sender, EventArgs e) in C:\Users\VistaDevAdmin\Documents\Visual Studio 2005\Projects\WebCapture\formDefault.vb:line 135
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WebCapture.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
---
Any ideas?
Thank you for your help.
|
|
|
|
 |
|
 |
Error here
checkAutoOverwrite.Checked = getLastRun("AutoOverwrite")
I replace by this code:
'LastRun.AutoOverwrite
If getLastRun("AutoOverwrite").ToString().Length > 0 Then
checkAutoOverwrite.Checked = True
End If
It works fine.
|
|
|
|
 |
|
 |
hi
nice code but can u help me
how can i copy a source code in txt file and
then later change the extension for example
source.txt to source.html to view the page
http://www.codeproject.com/asp/gethtmlsource/gethtmlsource_src.zip
i downlaoded that file but its a asp page
i want to use a it in my application
khurram saddique
|
|
|
|
 |
|
 |
Hello,
I can see that when the web pages you want to capture tries to open a popup the image saved is blank.
I tried to play with the NewWindow and CancelEventHandler and even if I succeed in not getting the popup I am still having a blank image at the end. Do you have any suggestions?
Another thing is when you load pages that contains other blocks loaded from other websites the capture do not contain all the blocks. how can we 100% sure that the web page is loaded when going to DocumentCompleted event?
Regards
|
|
|
|
 |
|
 |
How can I do the same in a web application?
thanks in advance
|
|
|
|
 |
|
 |
Hi, is useful artical. Sometime, I thought, is it possible to capture the whole page so I can show my client the full page. Now it's possible.
Thanks
|
|
|
|
 |
|
 |
Wow, the interface and the functionality are much better than the first version. I really like the interface. Keep up the good work.
|
|
|
|
 |
|
 |
Hi,
This utility is really useful.
But, how to make this work to capture the pages which open within the frames ?
Our website uses session values to check the page validity, so it does not allow to directly type the page name in the address bar too.
It will be really useful if i can capture the page within frame.
Thanks.
Vasanth
|
|
|
|
 |
|
 |
I think it is possible using some extra javascript or VB.net code. If possible, can I have the webpage you require, so I can do some test and if successful, I will post the code.
|
|
|
|
 |
|
 |
Don't have a use for it right now, but it works perfect here.
www.wickedorange.com
|
|
|
|
 |
|
 |
I am looking for a tool to do OCR from stream Java screen and save text to a database.
anyone ?
|
|
|
|
 |
|
|
 |
|
 |
instead of getting a page thru a specified url, would it be possible to get the page currently loaded in the browser (IE/FF plugin) ?
also, you should let the user choose in which format (BMP, JPG, PNG, GIF, etc.) he want the capture to be saved in...
|
|
|
|
 |
|
 |
Try using Reflector and check the code out for DrawToBitmap. Don't know if it works cross process though.
You would need to also get the window handles for the control which you want to capture.
www.wickedorange.com
|
|
|
|
 |