Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We have supplied a couple of other sample templates in the Examples folder.

Template Settings

Code Block
//Leave the properties which you want to change, you can safely remove the rest
var defaultSettings = {
    'marginTop' : 10, //mm
    'marginRight' : 10, //mm
    'marginBottom' : 10, //mm
    'marginLeft' : 10, //mm
    'pageSize' : 'A4', //full list http://doc.trolltech.com/4.6/qprinter.html#PageSize-enum
    'orientation' : 'portrait', //Possible values 'landscape' & 'portrait'
    'headerHeight' : 0, //mm
    'headerPadding' : 0, //mm
    'footerHeight' : 15, //mm
    'footerPadding' : 1 //mm
    'scales' : [ 250000, 125000, 50000, 25000, 10000, 5000, 2500, 1250, 1000, 500, 250, 125 ]
}

 

You may control the templates settings using the above defaultSettings. The values specified above are the default settings and as such may be removed entirely if you wish your template to use the defaults.

The ‘scales’ option above shows the default scales and as such may be removed altogether. To customise your own range of scales simply specify your own entries for the parameter. If a user enters a scale that is outside the defined range then the scale will default to the maximum or minimum entry as required.

When the map is selected the current scale will automatically be added to the selection as (Original 1:nnnn).

Warning
  1. Due to some restrictions adjusting the height of the map element to correctly position it in the selected page size; you will need to adjust the header and footer height or padding using these options. PLEASE DO NOT USE CSS TO ADJUST HEIGHT OR PADDING OF HEADER AND FOOTER.
  2. At present the page size and print scale only generate accurate results when defined in Millimeters, as above, and not pixels etc.

JavaScript

Code Block
<script type="text/javascript" src="../js/lib/prototype-1.6.0.3.js"></script>
        <script type="text/javascript" src="../FileIncluderJS.aspx"></script>
        <script>Astun.JS.IncludeJS('print');</script>
Warning

No JavaScript files should be removed as the maps and will not work properly.

Defining a Style Sheet

Code Block
<link type="text/css" rel="stylesheet" href="css/templates/astun-A4-common.css" />

We have provided one editable style sheet astun-A4-common.css with iShare which may be customised. We would suggest that you copy the supplied css before making your changes.

If you wish to use a different style sheet then please change this entry to reflect the style sheet you wish to use.