Today I decided to write a little program to capture every "screen" in our web-based application for regression/documentation purposes. We're undergoing major changes and I wanted something static to use as a reference. Granted, we have now (and will have in the future) digital copies of the current (soon to be previous) version of our application, I feel alot better about being able to just open up a notebook and look at what the application used to look like.
So, the bulk of my work consisted of capturing the graphical output of the Microsoft WebBrowser ActiveX control. I was initially using the .NET control, but experienced massive issues trying to cast to MSHTML interfaces that I knew the objects must inherit from. Yay! But anyways...Capturing input from the ActiveX control involved p/invoking good ol' GDI32 and blitting the output from the WebBrowser control onto a bitmap of my creation. Once that was done, I just took my fancy new bitmap and stuck it into a Adobe PDF using
PDFSharp (which is quite a handy library).
There are multitudes of articles on the internet about capturing a web page to an image, but none of them seem to deal with the issue of pages that have dynamic content (frames). My solution addresses this issue and also has a little bit of error handling -- just in case you happen upon an error page. By default, I have that functionality disabled though because the scanning is done in a very inefficient manner.
Well anyways...here are the
solution files if anyone ever needs 'em.