<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.11.0.css" />
<script src="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.11.0.js"></script>
<script src="https://maps-sdk.trimblemaps.com/addon/trimblemaps-exportmap-1.0.0.js"></script>
<link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/addon/trimblemaps-exportmap-1.0.0.css" />
<style>
body { margin: 0; padding: 0; }
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
TrimbleMaps.APIKey = 'YOUR_API_KEY_HERE';
const map = new TrimbleMaps.Map({
container: 'map', // container id
style: TrimbleMaps.Common.Style.TRANSPORTATION, // hosted style id
center: [-77.38, 39], // starting position
zoom: 3, // starting zoom
//printing requires that the renderer preserve the drawing buffer
preserveDrawingBuffer: true
});
const clientHeight = document.getElementById('map').clientHeight;
const clientWidth = document.getElementById('map').clientWidth;
const exportMap = new TrimbleMapsControl.ExportMap(
{
pageTitle: 'Printed Map',
top: 0,
left: 0,
height: clientHeight*4,
width: clientWidth*4,
addButton: true,
// attributionPosition: 'bottom-right', // default 'bottom-right' // 'bottom-left' // 'top-right' // 'top-left'
});
map.addControl(exportMap);
</script>
</body>
</html>