Whitepapers How WēPO works from a web page
Introduction
The Print Wizard engine is available as an ActiveX component within our Web Print Object, also known as WēPO. Most all the functionality of the Print Wizard Engine is included in the ActiveX WēPO product, allowing a web server to "push" a print job out to a locally attached or a local network printer, keeping with our philosophy of printer-independent printing.
There are some key concepts that you should understand:
- WēPO is an ActiveX control, an ActiveX object that has a specific control or user display (the button), that has a specific action associated with it (click it and it prints). It can be displayed on a web page or within someone else's program or script. The actually display of the button can be hidden and only the action called (see the javascript examples below).
- WēPO, and other ActiveX objects, must be registered with Windows in order to be used. This requires several Windows registry entries and requires any program that wants to use this object, call it by a class id, differentiating it from other objects.
- An ActiveX object or control has associated with it an object name, "PWButtonX Control" in our case, and a file with an extension of either "ocx" or "dll".
- A cabinet, a file with the .cab extension, simply contains the ActiveX control or object and any necessary files, in a compressed file format.
The WēPO ActiveX object is called PwButtonXControl1 or "PwButtonX Control" and in most cases when downloaded and installed through Internet Explorer, the ActiveX control can be found in the default browser objects download directory: Also note that if you reference a .cab file, the .ocx file will appear after the cabinet file is decompressed.
C:\Windows\Downloaded Program Files\PwButtonXControl1.ocx
- Netscape, Opera, Mozilla, Firefox and Apple Safari may support ActiveX either directly with security options set properly, or with the addition of third party add-ons. Check out their web sites for more information.
WēPO code on your web page
By placing WēPO code on your web page, you can provide a method whereby the viewer of that web page can request a local print of a host resident print job, archived print job or a report stream through a server-side script request.
The primary part of this is to include the "object" request on the web page. Within this is the height and width of the button, the text of the button and any parameters for the button:
<OBJECT
classid="clsid:4CE8026D-5DBF-48C9-B6E9-14A2B1974A3D"
codebase="http://www.anzio.com/controls30/printwizocx.cab#version=3,0,0,0"
width=50
height=25
align=center
hspace=0 >
<param name="mainurl" value="http://www.somewhere.com/myreport.pcl">
<param name="caption" value="Print">
</OBJECT>
You can also set this to NOT show the print button, but rather to have a javascript or other web language script do the printing:
<OBJECT
classid="clsid:4CE8026D-5DBF-48C9-B6E9-14A2B1974A3D"
codebase="http://www.anzio.com/controls30/printwizocx.cab#version=3,0,0,0"
width=0
height=0
align=center
hspace=0 >
<param name="mainurl" value="http://www.somewhere.com/myreport.pcl">
<param name="caption" value="Print">
</OBJECT>
...
<input type=button value="my print" OnClick="javascript:buttonclick();">
...
<script language=javascript>
<!--
function click(){
document.Pwbuttonx1.Click();
}
//-->
</script>
...
You can set the "mainurl" parameter to retrieve any normal URL data from a web site and force it to the printer. With this, not only can you retrieve data securely through the HTTPS protocol, but you could retrieve data from a live feed by calling a server-side script. In this manner no file needs be present on the host to go fetch, rather data is delivered dynamically and directly to the user's printer.
...
<param name="mainurl" value="https://www.abc.com/cgi-bin/myquery?select=all>
...
WēPO supports secure web printing through the https SSL protocol
WēPO parameters for the web page
There are many parameters for the WēPO print object, allowing you to control the output of the print job. The table below defines most of these, check the WēPO section of the Print Wizard manual for a complete and up-to-date listing.
| <param name="mainurl" value="URLname"> |
Enter the local file name or the main URL name to print from |
| <param name="caption" value="Print"> |
The test to appear in the middle of the button |
| <param name="Cancel" value="0"> |
Set this (through code) to 1 to cancel a print job |
| <param name="Default" value="0"> |
Set this to 1 to use the default printer |
| <param name="Enabled" value="-1"> |
A zero value disables the button |
| <param name="Font" value="MS Sans Serif"> |
Specifies an initial font for printing |
| <param name="Visible" value="-1"> |
A zero value hides the button |
<param name="licensecode" value>
|
If a licensecode is specified, and it correlates to the location of the MainURL,
then the OCX will NOT print out a line indicating it was printed with a demo
version. License codes are provided by Rasmussen Software. |
<param name="printersetup" value="0">
|
A non-zero value will cause WēPO to prompt the user for Printer Setup, allowing
them to choose a printer and set its properties. |
| <param name="printername" value="printer"> |
Indicates which printer to use, by its Windows printer name. After printing, this
parameter will contain the name of the printer that was used, such as the one
selected via Printer Setup. |
<param name="charset" value>
|
Specifies the character set of the print data. Options are “ISO”, “OEM”, and
“UTF-8”. Default is ISO. |
<param name="debug" value="0">
|
A non-zero value tells the OCX to run in debug mode, displaying a lot of useful
information in a popup window |
<param name="initfile" value>
|
Specifies a print initialization file, this can be on a local disk, or a URL |
<param name="orientation" value>
|
Sets the printing orientation. Possible values are “portrait”, “landscape”, or
“auto”. |
<param name="duplex" value>
|
Tells the printer to print on both sides of the paper, if possible. Possible values are
"off", "vertical", "horizontal", "left", "right", or blank. If blank, the duplexing will
follow the printer driver's configuration. |
<param name="fontname" value>
|
Specifies an initial font for printing. |
<param name="overlay" value>
|
The name of a file to be used as a full-page form overlay. |
| <param name="preview" value="0"> |
A value of one turns print preview on. |
<param name="faxnum" value="5035551212">
|
The fax number to vax to. This requires that Fax for Windows (Fax32) or WinFaxPro be installed on the local PC. |
| <param name="translatepcl" value="1"> |
A non-zero value causes WēPO to translate any PCL codes in the main print job
and/or the overlay file(s), allowing them to be printed on any printer. |
| <param name="captionfont" value="fontname"> |
The name of the font used to display the caption in the button. The default is set
by the font of the preceding HTML. |
| <param name="captionheight" value="10"> |
The size (in points) of the font used for the caption. The default is set by the font
of the preceding HTML. |
| <param name="captionstyle" value="style"> |
A string representing the style to be used for the caption. Include, in any order,
"B" for bold, "I" for italics, and/or "U" for underline. The default is set by the
font of the preceding HTML. |
Accessing a web page with WēPO the first time
The first time you access a web page that contains a WēPO ActiveX Control, you will be asked to allow the Download of the control. In order to permit this under the latest versions of Windows, you must OK the first box and click on the security bar at the top. Click on "Install ActiveX Control..." to begin the install process.


At this point you will receive a second dialog box asking you to install the ActiveX component. Click "Install" and within a few seconds the download should finish and your page should display the control correctly.

If the dialogs mentioned above never appear, check your Internet Options and Advanced settings. It is possible that the options are set to automatically allow the ActiveX, or to never allow any client side add-ons.
What we have described above pertain to the default settings for Internet Explorer version 6 or later. Other versions and other web browsers may behave differently or not even allow ActiveX controls. See the Print Wizard and WēPO manual for more information.
Activating the control
With the latest Internet Explorer 6 patch releases and with Internet Explorer 7, an ActiveX control is NOT activated for use immediately. In order for you to utilize an ActiveX control, you must click twice. This can be a pain, but it is there partly for security reasons - so the user knows that an ActiveX control is being utilized.
Additionally, it is possible to get around this activation issue. You have two options:
where "weposcript.js" would read something like this:
document.write('<OBJECT ');
document.write('classid=
"clsid:4CE8026D-5DBF-48C9-B6E9-14A2B1974A3D" ');
document.write('codebase=
"http://www.anzio.com/controls30/printwizocx.cab#version=3,0,0,0" ');
document.write('width=50 ');
document.write('height=25 ');
document.write('align=center ');
document.write('hspace=0 ');
document.write('> ');
document.write('<param name="mainurl" value=
"http://www.abc.com/myreport.txt">');
document.write('<param name="caption" value="Print">');
document.write('<param name="Cancel" value="0">');
document.write('<param name="Default" value="0">');
document.write('<param name="DragCursor" value="-12">');
document.write('<param name="DragMode" value="0">');
document.write('<param name="Enabled" value="-1">');
document.write('<param name="Font" value="MS Sans Serif">');
document.write('<param name="Visible" value="-1">');
document.write('<param name="DoubleBuffered" value="0">');
document.write('<param name="Cursor" value="0">');
document.write('<param name="licensecode" value>');
document.write('<param name="charset" value>');
document.write('<param name="debug" value="0">');
document.write('<param name="initfile" value>');
document.write('<param name="orientation" value>');
document.write('<param name="duplex" value>');
document.write('<param name="fontname" value>');
document.write('<param name="overlay" value>');
document.write('<param name="bitmap" value>');
document.write('<param name="faxnum" value>');
document.write('<param name="printersetup" value="0">');
document.write('</OBJECT>');
For some reason known only to Microsoft, you can do the external script approach, but you cannot directly control the object from within a javascript function located on the same page. While this works to show the control, it still requires a double click to activate. It must be an external script to get around the double click activation issue.
Managing WēPO through the browser
Installing and registering WēPO
There is no pre-installation process available from within a web browser for WēPO. You can install and register the ActiveX control all from a web page that calls that object. If the dialogs mentioned above never appear when you first access a page with a WēPO control on it, check your Internet Options and Advanced settings. It is possible that these are either set to automatically allow the ActiveX, or to never allow any client side add-ons.
Disabling and uninstalling WēPO
From within your browser it is possible to manage your "add-ons" and either disable or delete them from use. This is done through the Tools menu Internet Options (also available under the Windows Control Panel). Under the Programs tab, click on "Manage add-ons...".

From here you can select the correct control, "PwButtonX Control" and disable or delete it.
When you "delete" the add-on, it removes the proper Windows registry entries (the object registration information) and deletes the file from the specified area.

When "disabled" the WēPO ActiveX control does not display properly and cannot be double clicked to activate, but is still registered in Windows and found in the download directory.
Managing WēPO through Windows
The WēPO ActiveX object can also be managed through Windows itself, either via the Control Panel or through console command-line driven applications.
Installing and registering WēPO
At present there is no manual procedure for installation of the WēPO object. However, you can register the object manually from a command line prompt or a script. To do this you would use the "regsvr32.exe" program:
regsvr32 c:\MyDirectory\PwButtonXControl1.ocx
This will correctly register the WēPO object for use by web pages, pointing to your directory of choice.
Uninstalling and unregistering WēPO
You can unregister the object and uninstall WēPO from the Internet Options dialog in Windows (found in the Control Panel and done exactly as above through your browser).
You can also manually unregister WēPO through the "regsvr32.exe" program and then manually remove the "ocx" file from the disk. To do this enter the following:
regsvr32 -u c:\MyDirectory\PwButtonXControl1.ocx
How Windows handles WēPO internally
Upon first trying to use this, Internet Explorer 6 and Internet Explorer 7 will warn you that the web
page needs to download and install an ActiveX. Browser's top bar needs to
be right-clicked on to allow download and may need a second click to
install (or you will need to verify Install from a download dialog by clicking OK). Once you do this, the object is then registered in the Windows registry automatically for use by the web browser.
There have been reports that with some browsers and with certain browser settings in effect, if you once deny this install, then the next time you come to this page it will be assumed to not allow it and no security bar message pops up.
Various browser behave differently and may locate files in other directories or registry entries, but the concept is the same.
When installed the first time through a browser, the WēPO object (the file name will be PwButtonXControl1.ocx)
resides in
C:\Windows\Download Program Files\
With new releases and changes in class-id, there would thus be a conflict. Windows changes the directory name for these conflicts, with duplicate files ending up in
C:\Windows\Download Program Files\CONFLICT.1,
C:\Windows\Download Program Files\CONFLICT.2, ...
If you have conflicts, the ocx in the latest CONFLICT.x appears to get
used, i.e. CONFLICT.2 and you can actually remove the others without any problems.
Also on initial setup, the following registry entries point to this ActiveX
file:
\My Computer\HKEY_CLASSES_ROOT\CLSID\{4CE8026D-...\
\My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{4CE8026D-...\
\My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrentVersion\ModuleUsage\C:/Windows/Downloaded Program
Files/CONFLICT.1
(and other pointers to other CONFLICTs if they exist with OCX)
\My Computer\HKEY_LOCAL|MACHINE\SOFTWARE\Microsoft\CurrentVersion\SharedDLLs
When you delete a registered ActiveX component from within the Internet Options "Manage add-ons" dialog, the registry entries are first removed and then the object file is deleted from disk. The "regsvr32.exe -u ..." will unregister the ActiveX object as well (it just does not automatically remove it from disk).
|