Y-SLD/assets/plugins/leaflet/print-master/examples/index.html

52 lines
1.5 KiB
HTML
Raw Permalink Normal View History

2024-03-01 11:23:55 +00:00
<!doctype html>
<html>
<head>
<title>Leaflet Printing</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.3/leaflet.css"/>
<link rel="stylesheet" href="../dist/leaflet.print.css"/>
</head>
<body>
<div id="map" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></div>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script src="../dist/leaflet.print.js"></script>
<script src="http://localhost:8080/mapfish-print/pdf/info.json?var=printConfig"></script>
<script>
var map,
printProvider,
printControl,
ll = new L.LatLng(-36.852668, 174.762675);
map = L.map('map', {
center: ll,
zoom: 15
});
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker(ll).addTo(map);
// Create the print provider, subscribing to print events
printProvider = L.print.provider({
capabilities: printConfig,
method: 'GET',
dpi: 254,
outputFormat: 'pdf',
customParams: {
mapTitle: 'Print Test',
comment: 'Testing Leaflet printing'
}
});
// Create a print control with the configured provider and add to the map
printControl = L.control.print({
provider: printProvider
});
map.addControl(printControl);
</script>
</body>
</html>