Further Control of Printing

Jake Howlett, 3 January 2002

Category: Forms; Keywords: ActiveX Print Header Footer

If I had a pound for every time I had started an article with the line "If I had a pound for every time....". Do you see what I've done there?? Sorry, I'm in a daft mood today. Must be all the Christmas food and drink gone to my senses.

Seriously though, there are questions that I get asked so many more times than others that it gets to a point where I have to find out how and then write about it. Even though, in this case, it's not something you would actually find me doing unless I was pressed in to it. In the words of Ruth Harris (the last person to ask me) here's the problem:

The form is several pages long, and when users print out their finished form (in IE5) , it has the lengthy URL at the bottom of each page. Is there any way to make that not print out? It is ugly and looks intrusive on the page.

The answer I usually give depends on the mood I am in. Catch me in a good mood and I'll say "Yes, it can." However, it's the nature of the solution that leads me to sometimes say no. Whether or not you decide to use it is, of course, down to you.

A little background:

Whether or not you see the URL of the current page printed on the page is a part of the Page Setup [File - Page Setup] settings for the user's browser, as shown below.


Notice that the Footer box contains the MetaSymbol &u. This tells the browser to print the URL. The others correspond to the following:

Internet Explorer Header and Footer Metasymbols
To print specific information as part of the header or footer, include the following characters as part of the text
Type this To print this
&w   Window title
&u   Page address (URL)
&d   Date in short format (as specified by Regional Settings in Control Panel)
&D   Date in long format (as specified by Regional Settings in Control Panel)
&t   Time in the format specified by Regional Settings in Control Panel
&T   Time in 24-hour format
&p   Current page number
&P   Total number of pages
&&   A single ampersand (&)
&b   The text immediately following these characters as centered.
&b&b   The text immediately following the first "&b" as centered, and the text following the second "&b" as right-justified.

Using the above symbols you can print as little (nothing) or as much information as you like. Note however that these settings apply to all pages once they have been changed.

The solution:

Well, not one but three really. The second is the preferred in my opinion but the third is probably the most interesting and the one I'll spend the most time discussing.

The first and simplest is to tell the user to open the Page Setup dialog and remove the &u meta-symbol. Not very desirable but it works and it can be applied on a basis of only those that object to the URL need to be told how.

Secondly you can administer this via your NT Network using something like IEAK or another central Registry control technique. Either of these would simply control the content of the following Registry key:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\footer

The third and most complex is to use Mead & Co's ScriptX. This is an ActiveX component that, once downloaded, can allow the developer complete control over the printing process.

When you opened this page (if you are using IE) you probably saw a prompt to accept the install of an ActiveX component. Sorry if this shocked you but I've had to embed this object so that I can demonstrate the technique. If you declined the install initially then you may want to reload the page and accept it. This way you can see what I am talking about. You only need to do this once.

Assuming you have installed the component then you can use the following button to print this page. Notice the difference in the Header and Footer.

Here's another example where you can decide what the Header and Footer should be "on the fly".

Customised Print Settings
Header: Footer:
Prompt: Show settings dialog

So, there you have it. Using JavaScript and the ScriptX component you can cater for occasions where you don't want to see the URL at the bottom of a printed page.

Using ScriptX in Domino:

First thing you need to do is add the ScriptX Cab file as a resource to your site. You can then let users download it, with or without an internet connection. Download it either from the Meadroid site or from the link near the top of this page.

In Domino Designer, go the Image Resource section and choose to add a new one. Navigate to the folder with your ScriptX.cab file in it and type "*.cab" in the File Name box. Select the file and press Open:


You can now add the following PassThru HTML code to the form that is going to be printed.

<object classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" id="factory" codebase="ScriptX.cab#Version=5,60,0,375" style="display:none" viewastext>

You will of course need to alter the codebase attribute so that it points to the correct path of your database. To make this easier I highler recommend you use this method. Next time a user opens this form they will see a prompt to install the component. Most of them will probably just say yes....

Now you just need to add some JavaScript to handle the methods and properties of this new object. How much you add depends on how you want to handle print requests. The most basic would look something like this.

function PrintBasic() {
document.factory.printing.header = "MeadCo\'s ScriptX Changed This";
document.factory.printing.footer = "";

You can make this even more powerful using the following settings:

document.factory.printing.portrait = false
document.factory.printing.leftMargin = 1.0
document.factory.printing.topMargin = 1.0
document.factory.printing.rightMargin = 1.0
document.factory.printing.bottomMargin = 1.0

These are the just the properties available to unregistered copies of the ScriptX component. License it and you get a whole lot more, extremely useful, functionality.


Whether or not you like this method it certainly seems to answer the above problem. How it does it may not be so slick but it shows how powerful ActiveX components can be.

I have only demonstrated the basic features of the ScriptX download. Have a look at their website and see what else it can do for your site. This is also where you will find answers to most problems you may have when implementing the above solution. I have refrained from going in to too much detail as it is all covered in the documentation that comes with the download on the site. They also discuss the necessary settings of the browser for the download to be allowed and provide lots more examples.

Further reading: