NAME
Win32::CaptureIE - Capture web pages or its elements rendered by Internet Explorer
SYNOPSIS
use Win32::CaptureIE;
StartIE;
Navigate('http://my.server/page.html');
my $img = CaptureElement('tab_user_options');
$img->Write("ie-elem.png");
QuitIE;
DESCRIPTION
The package enables you to automatically create screenshots of your web server pages for the user guide or whatever you need it for. The best part is that you don't bother yourself with scrolling and object localization. Just tell the ID of the element and receive an Image::Magick object. The package will do all the scrolling work, it will take the screenshots and glue the parts together.
EXPORT
- :default
-
CaptureBrowser
CaptureElement
CaptureRows
CapturePage
CaptureThumbshot
GetDoc
GetElement
Navigate
QuitIE
Refresh
StartIE
$Body
$CaptureBorder
$Doc
$HWND_Browser
$HWND_IE
$IE
Internet Explorer controlling functions
- StartIE ( %params )
-
This function creates a new Internet Explorer process via Win32::OLE. You can specify width and height of the window as parameters.
StartIE( width => 808, height => 600 );
The function will bring the window to the top and try to locate the child window where the page is rendered.
- QuitIE ( )
-
Terminates the Internet Explorer process and destroys the Win32::OLE object.
-
Loads the specified page and waits until the page is completely loaded. Then it will call
GetDoc
function. - Refresh ( )
-
Refreshes the currently loaded page and calls
GetDoc
function. - GetDoc ( )
-
Loads
$Doc
and$Body
global variables. - GetElement ( $id )
-
Returns the object of specified ID by calling
document->getElementById()
.
Capturing functions
These function works like other Capture*(...)
functions from Win32::Screenshot package.
- CaptureBrowser ( )
-
Captures whole Internet Explorer window including the window title and border.
- CapturePage ( )
-
Captures whole page currently loaded in the Internet Explorer window. Only the page content will be captured - no window, no scrollbars. If the page is smaller than the window only the occupied part of the window will be captured. If the page is longer (scrollbars are active) the function will capture the whole page step by step by scrolling the window content (in all directions) and will return a complete image of the page.
- CaptureElement ( $id | $element [, \%args ] )
-
Captures the element specified by its ID or passed as reference to the element object. The function will scroll the page content to show the top of the element and scroll down and right step by step to get whole area occupied by the object.
It can capture a small surrounding area around the element specified by %args hash or
$CaptureBorder
global variable. It recognizes paramtersborder
,border-left
,border-top
,border-right
andborder-bottom
. The priority isborder-*
->border
->$CaptureBorder
. - CaptureRows ( $id | $element , @rows )
-
Captures the table specified by its ID or passed as reference to the table object. The function will scroll the page content to show the top of the table and scroll down and right step by step to get whole area occupied by the table. Than it will chop unwanted rows from the image and it will return the image of table containing only selected rows. Rows are numbered from zero.
It can capture a small surrounding area around the element specified by
$CaptureBorder
global variable. - CaptureThumbshot ( )
-
Resizes the window to set the client area to 800x600 pixels. Captures the client area where the page is rendered. No scrolling is done.
Global variables
- $CaptureBorder
-
The function
CaptureElement
is able to capture the element and a small area around it. How much of surrounding space will be captured is defined by$CaptureBorder
. It is not recommended to capture more than 3-5 pixels because parts of other elements could be captured as well. Default border is 1 pixel wide. - $IE
-
The function
StartIE
will create a new Internet Explorer process and its Win32::OLE reference will be stored in this variable. See the MSDN documentation for InternetExplorer object. - $Doc
-
The function
GetDoc
will assign$IE->{Document}
into this variable. See the MSDN documentation for Document object. - $Body
-
The function
GetDoc
will assign$IE->{Document}->{Body}
into this variable. See the MSDN documentation for BODY object. - $HWND_IE
-
The function
StartIE
will assign the handle of the Internet Explorer window into this variable from$IE->{HWND}
. - $HWND_Browser
-
The function
StartIE
will try to find the largest child window and suppose that this is the area where is the page rendered. It is used to convert page coordinates to screen coordinates.
SEE ALSO
- MSDN
-
http://msdn.microsoft.com/library You can find there the description of InternetExplorer object and DOM.
- Win32::Screenshot
-
This package is used for capturing screenshots. Use its post-processing features for automatic screenshot modification.
AUTHOR
P.Smejkal, <petr.smejkal@seznam.cz>
COPYRIGHT AND LICENSE
Copyright (C) 2004 by P.Smejkal
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 520:
'=item' outside of any '=over'
- Around line 530:
You forgot a '=back' before '=head1'