Skip to main content

Export Map Add-on

The Export Map add-on allows printing of the map

Example setup

View a working demo and follow the steps below to create your own

<link href="https://maps-sdk.trimblemaps.com/addon/trimblemaps-exportmap-1.0.1.css" rel="stylesheet">
<!-- Export Map addon reference css -->
<script src="https://maps-sdk.trimblemaps.com/addon/trimblemaps-exportmap-1.0.1.js"></script>
<!-- Export Map addon reference js -->
TrimbleMaps.APIKey = "YOUR_ACCESS_TOKEN";

var map = (window.map = new TrimbleMaps.Map({
  container: "map",
  style: TrimbleMaps.Common.Style.TRANSPORTATION,
  zoom: 12.5,
  center: [-77.01866, 38.888],
  region: TrimbleMaps.Common.Region.NA,
  //printing requires that the renderer preserve the drawing buffer
  preserveDrawingBuffer: true
}));

// capture the dimensions of the map element
const clientHeight = document.getElementById('map').clientHeight;
const clientWidth = document.getElementById('map').clientWidth;

// setup the export map control
const exportMap = new TrimbleMapsControl.ExportMap(
{
    pageTitle: 'Printed Map',
    top: 0,
    left: 0,
    height: clientHeight,
    width: clientWidth,
    addButton: true
});

// add control to map
map.addControl(exportMap);

Customization Options

Parameter Type/Values Description
pageTitle
String
Default: Trimble Maps
The title of the print preview window
top
Number
Specifies the distance in pixels from the top side of the work area where the new window will be generated.
left
Number
Specifies the distance in pixels from the left side of the work area where the new window will be generated.
height
Number
Specifies the height in pixels of the print preview window.
width
Number
Specifies the width in pixels of the print preview window.
addButton
Boolean
Indicates if there should be a button added to the map.
attributionPosition
String
Indicates the location on the map to place the attribution. Valid values include ‘bottom-right’, ‘bottom-left’, ’top-right’, ’top-left’. The default is ‘bottom-right’

API Documentation

View Export Map API Documentation

Last updated July 13, 2023.