Katja Zinchenko <> wrote:
> Thanks for the hint, and sorry, yes, my question was too vague. What I wanted to
> ask is: Is there a perlish way to save the contents of a web page to an image
> file exactly the way a browser (any recent browser) would render it? I'd like to
> pass my script a url and automatically get a kind of screen shot of the web
> page. There doesn't seem to be a perl module (at least not on CPAN) to that
> purpose, and as far as I could find out, mozilla, firefox, galeon, konqueror and
> opera don't support any command line options to have them print to a file.
> Thank you,
> Katja
But even the same browser would show it differently for various users.
You must also realize that most of the sites do not fit within one browser
window which is about 1024x768 pixels in size.
The only way that comes to mind - an abstract implementation:
1) Launch the browser to the requested URL from a perl script.
Your browser and whatever it displays are an X11 window within your
window manager/desktop environment.
2) Use the perl library corresponding to your window manager or even an
X11 perl interface to capture the window into an image.
OR
2) Use scriptlets supplied with your window manager (some have them) that
do the window capture. AFAIK Afterstep has this ability. I am not sure
but it is possible that X11 package has a program to take a shot of a full
desktop. Then, knowing your browser X11 geometry you can crop out the
browser itself.
The image would usually be saved in the XWD format.
3) Use an image conversion library of perl (or an external application)
to convert XWD to JPG or whatever.
Note: all this might be done with a shell script and existing Linux
utilities without Perl.
--
Roman M. Parparov - NASA EOSDIS project node at TAU technical manager.
Email:
http://www.nasa.proj.ac.il/
Phone/Fax: +972-(0)3-6405205 (work), +972-(0)50-734-18-34 (home)
----------------------------------------------------------------------
The economy depends about as much on economists as the weather does on
weather forecasters.
-- Jean-Paul Kauffmann