Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I am wondering how hard it would be to write a c++ program that would print the screen of a web page. Just a simple program that would take a snap shot of the page.
Posted
Updated 22-May-11 5:01am
v2
Comments
NuttingCDEF 22-May-11 10:20am    
Are you talking about something a user runs so that if they open a page in their favourite browser they can run an app to snap a copy and print it? In which case you need a way to automate control of Internet Explorer / Firefox / Safari / . . .

Or an app that will take a URL, download the web page and generate an image to print? In which case you need to write a web browser / rendering engine that understands HTML, CSS, probably JavaScript, maybe Flash . . .

Or something else entirely . . .

A bit more info on exactly what you want to achieve would be useful.
JD1980 22-May-11 11:06am    
Sorry I'm new to this forum. I'm just looking for something simple that would just take a screen shot of the page. I am not very good at this and dont understand it very well.

1 solution

Start of with capturing the contents of the browser window:
Screen capture, window resizing utility with source code[^]

Send page down to the browser until the captured image does not change anymore:
http://msdn.microsoft.com/en-us/library/ms646310(VS.85).aspx[^]

Stich the resulting images into a single image.
CBitmapEx - Free C++ Bitmap Manipulation Class[^] - should get you of to a fair start ...

Print the resulting image
Printing tips and tricks from the trenches[^] - good info on printing from C++

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-May-11 12:53pm    
Good sources, my 5.
--SA
Espen Harlinn 22-May-11 14:38pm    
Thanks SAKryukov :)
Sandeep Mewara 22-May-11 13:25pm    
My 5+!
Espen Harlinn 22-May-11 14:39pm    
Thanks S Mewara :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900