Closed hikarym closed 6 years ago
Hi @hikarym
How are you adding leaflet-easyPrint to your application?
Depending on your setup you either need to add it via a script tag (after you've added leaflet) or require
the module if you're using a bundling tool like Webpack.
Hi @rowanwins I am using html, javascript and leaflet without a bundling tool. Into the html file i put:
I thought that to add the printing control to my map it was only necessary to write this one: L.easyPrint({ tileLayer: layerOSM, sizeModes: ['Current', 'A4Landscape', 'A4Portrait'], position: 'topleft', filename: 'myMap', exportOnly: true, hideControlContainer: true }).addTo(map);
In the head of your document I you need to add the bundle.js
file from the dist folder of this repo, you need to add it after leaflet has been added
<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"></script>
<script src="dist/bundle.js"></script>
or you could use rawgit which means you grab the files directly via the web rather than having to download them
<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"></script>
<script src="https://cdn.rawgit.com/rowanwins/leaflet-easyPrint/gh-pages/dist/bundle.js"></script>
Thanks @rowanwins I solved the problem :)
The print button doesn't appear and display the next error on the browser: Uncaught TypeError: L.easyPrint is not a function
My code is: