This example demonstrates most of the Feature Set #1 printing capabilities provided by MeadCo's MaxiPT print template. These are significantly more rich and customizable than those provided with Internet Explorer 5.5+ and are in fact much closer to Office.
Invoke Print Preview here or from IE's native controls to see it in action. You can view the source of this example here.
Scripting MaxiPT Feature Set #1 functions
The functions available in MaxiPT's Feature Set #1 will usually be set from document.printingRules in script. Please View the source of this example to see how they are scripted in response to the body.onload() event.
Prevent your users from making changes on the Preview pane
By default, MaxiPT Feature Set #1 provides an 'Extra...' toolbar button on the Preview pane. This button invokes a dialog on which your users can make changes to the template's attributes, as described below.
To disable this button (i.e. to prevent your users from making template attribute changes from the Preview pane), set this printingRule:
setupExtraButton: "disabled"
MaxiPT Feature Set #1 also provides a 'Page Setup' toolbar button on the Preview pane. To remove this button (i.e. to prevent your users from making Page Setup changes from the Preview pane), set this printingRule:
setupButton: "hidden"
Allow your users to make changes on the Preview pane
When you're in Print Preview, select the Extra... toolbar button. MaxiPT's Feature Set #1 incorporates the following properties, some of which can be changed on the Extra properties dialog:
To switch this functionality on, check the Activate checkbox on the Extra properties dialog in the top right corner of the Header and Footer group.
You can edit the HTML text for the header and footer directly using the input boxes on this group. The example below shows a header scripted like this:
<div style="border: 1pt solid red; font: bold 12pt Arial; background: threedface; color: navy; padding-Top: 5px; padding-Bottom: 6px; background-Image: url(http://www.meadroid.com/non_act_bg.jpg)"> <center><i>--- Header for page <b> &p </b> ---</i></center></div>
To print specific information as part of the header or footer, include the following meta-characters as part of the text:
Shorthand | Meaning |
&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 |
Uncheck the Activate checkbox in the top right corner of this group if you don't need HTML headers & footers. In this case the headers and footers will be set to their default values, for example:
"&w&bPage &p of &P"
MaxiPT's HTML header and footer functionality can be switched directly from document.printingRules in script:
allPagesHeadFoot: true,
To switch this functionality on, check the Activate checkbox in the top right corner of the Header and Footer for The First Page group. You can edit the HTML text for the header and footer directly using the input boxes on this group.
If you switch it off, Header and Footer for The First Page will be set to match the default Header and Footer.
This functionality can be switched directly from document.printingRules in script:
diffFirstPageHeadFoot: true
This functionality can only be set directly from document.printingRules in script. This is how the footer image on the first previewed/printed page of this example is defined:
document.printingRules.extraFirstPageFooter = "<div><img src='http://www.meadroid.com/support/sx_stat.gif'></div>"
This functionality can only be set directly from script:
document.printingRules.firstHeaderHeight = 180; document.printingRules.firstFooterHeight = 180; document.printingRules.extraFirstFooterHeight = 60; document.printingRules.allHeaderHeight = 120; document.printingRules.allFooterHeight = 120;
All of these values will be calculated automatically if you don't set their properties.
This functionality allows you select the page range to print. It can also be set from script:
document.printingRules.pageRange = "1,3-5,7,9-11";
pageRange can also be set to "all" or "default".
This functionality allows you to specify how to print selected pages. It can also be set from script:
document.printingRules.printingPass = "odd&even";
printingPass can be set to "odd", "even" or "all" (same as "odd & even").
To switch this functionality on, check the Mirror Margins checkbox in the top left corner of the Printing Range group. It allows you to switch left and right margins as inner and outer margins for double-side printing. It can also be set from script:
document.printingRules.mirrorMargins = true;
Note: you can switch mirrorMargins on only for double-side printing, when Printing Range is set to "odd & even".