Skip to content

trying to add print on leaflet map #18

Description

@ashleycribb

Here is my html file.

<TITLE>Permitable</TITLE>
<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="../content/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(34.22629, -77.872991);
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
var 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
var printControl = L.control.print({
  provider: printProvider
});

map.addControl(printControl);
</script>

The control is not coming up to print. Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions