Moxi Media Inc.
<template> Discussion Forum

IMF Developer's Guide » Print Configuration » <template>  

The <template> element is used to define a template for creating a hard-copy PDF map. The template defines the map surround and the location of rectangles, lines, text, images, graphic elements (such as logos), the map, and legend images. Multiple templates can be defined in a print configuration file. The template names will appear in a drop-down list on the form used to request the printed map.

Note: The graphics defined as sub-elements in the template element are drawn in the order that they appear within the template element.

Frequency Parent Elements (the <template> element is valid within):
PRS+ <print-config>
   

Frequency Child Elements (the <template> element may contain):
O+ <box>
O+ <centercoordinatetext>
O+ <datetext>
O+ <image>
O <indexmap>
O <legend>
O+ <line>
O <map>
O+ <northarrow>
O+ <paragraph>
O+ <scaletext>
O+ <text>
O+ <titletext>
   

Frequency Description (in this context)
PRS+ The <template> element must appear one or more times in the <print-config> element in the specified sequence.
O+ The child element may appear one or more times in the <template> element in any order.
O The child element may appear only once in the <template> element in any position.
   

Attributes Description
name The name of the map template to be displayed in the form when requesting the map. Example: "8.5 x 11 - Landscape". Required.
units The units of measure used to define the positions and sizes of the template elements. Valid values are "points", "inches", "centimeters" or "millimeters". There are 72 points in an inch. For example, if you specify points, the position and size attributes of the <box> element must be specified in points too. Note that some attributes (such as line width and font size) are always defined in points. The attribute is optional, defaulting to "points".
page-size The page size, expressed in the units defined in the "units" attribute. The size should be two numbers separated by a comma (with no white space), representing the width and the height of the image. For example, if the units are "points", the entry for a landscape page on 8.5 x 11 inch paper would be page-size="792,612". Required.
border-width The border width, expressed in the units defined in the "units" attribute. All pages should have a border, even if you draw within it, as a signal to the printer that it can be printed on one page. Many printers cannot print to the edges of the page. The value should be numeric. For example, if the units are "points", a half inch border is defined using border-width="36". Required.
   

Example:

<template name="8.5 x 11" units="points" page-size="792,612" border-width="20">
  <!-- main page border -->
  <box position="20,20" size="752,572" outline-width="1"/>
  <!-- title border and contents -->
  <image position="22,553" url="$FRAMEWORK/images/bc/bcsigc_p.png" size="100,41"/>
  <titletext position="386,564" font="helvetica_bold" alignment="center" font-size="16" default="maps.gov.bc.ca"/>
  <box position="22,556" size="748,34"/>
  <!-- bottom box area and contents -->
  <box position="22,22" size="748,40"/>
  <paragraph position="24,26" size="340,36" font="helvetica" font-size="9" line-height="12" text="CAUTION: Maps obtained using this site are not designed to assist in navigation. These maps may be generalized and may not reflect current conditions. Uncharted hazards may exist. DO NOT USE THIS MAP FOR NAVIGATIONAL PURPOSES."/>
  <scaletext position="768,50" font="helvetica" font-size="9" prefix="Scale 1:" alignment="right"/>
  <text position="768,38" font="helvetica" font-size="9" text="Ministry of Sustainable Resource Management" alignment="right"/>
  <datetext position="768,26" prefix="Printed: " font="helvetica" font-size="9" format="datetime_medium" alignment="right"/>
  <northarrow position="460,24" size="30,30" url="$FRAMEWORK/images/northarrow4.png"/>
  <!-- legend area -->
  <box position="594,64" size="175,490" outline-width="1"/>
  <legend position="595,242" size="173,310" dpi="144"/>
  <line from="594,240" to="769,240" width="1"/>
  <indexmap position="595,65" size="173,173" dpi="216"/>
  <!-- map box and image -->
  <map position="22,64" size="570,490"/>
  <box position="22,64" size="570,490" outline-width="1"/>
  <!-- draw center coordinate text over the map -->
  <centercoordinatetext position="587,69" font="helvetica" font-size="9" alignment="right"/>
</template>