Error when trying to print

90 views
Skip to first unread message

JenBruce

unread,
Oct 27, 2015, 5:12:25 PM10/27/15
to Leaflet
Forgive me I am new to this system --
I grabbed a sample program and attempted to add the print function to it --
it does display the little print icon - but when you click on it it says:

TypeError: this._actionsContainer is undefined --  leaflet.print.js:5:12685

The code is below - any help would be truly appreciated !!

<!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="http://cdn.leafletjs.com/leaflet/v0.7.7/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="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>

    <script src="../dist/leaflet.print.js"></script>

//    <script src="http://localhost:8080/mapfish-print/pdf/info.json?var=printConfig"></script>
//    <script src="http://demo.mapfish.org/2.2/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,
      url: 'http://path/to/mapfish/print',
//autoLoad: true,
      method: 'GET',
      dpi: 254,
      map: map,
      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>

Valerio De Luca

unread,
Feb 20, 2016, 4:41:24 AM2/20/16
to Leaflet
hi jen,
have u a solution for print button? the examples of plugin seems doesn't work:
http://vdlmap.com/Leaflet.print-master/examples/index.html
tks
best
valerio
Reply all
Reply to author
Forward
0 new messages