Igor-Vladyka / leaflet.browser.print

A leaflet plugin which allows users to print the map directly from the browser
https://igor-vladyka.github.io/leaflet.browser.print/
MIT License
154 stars 76 forks source link

Error when auto is set as single print mode #59

Closed DankoHR closed 5 years ago

DankoHR commented 5 years ago

I am trying to print map with image overlay in auto mode. But when adding auto mode as single print mode following error occures:

Cannot read property 'Mode' of undefined at e._getMode (leaflet.browser.print.js:135) at e._printAuto (leaflet.browser.print.js:155) at HTMLDivElement.r (leaflet.js:5)

When adding a second print mode (e.g. landscape) to printModes array everything works fine. Below my code:

<body>
    <div id="mapid"></div>
    <script>
        // map init
        var map = L.map('mapid', {
            crs: L.CRS.Simple, 
            minZoom: -5
        });

        // set image overlay and bounds
        var bounds = [[0,0], [6623, 9363]];
        map.fitBounds(bounds);
        L.imageOverlay('plan1.jpg', bounds).addTo(map);

        //init print
        L.control.browserPrint({
            printModes: [
                L.control.browserPrint.mode.auto()
            ]
        }).addTo(map);           
    </script>
</body>
Igor-Vladyka commented 5 years ago

Hello.

Thanks for pointing that out. Problem solved in latest update. v0.8.3.

Please let me know if you have any other problems.

Regards, Igor

DankoHR commented 5 years ago

Hi Igor,

thank you very much for the fast fix and response. With 0.8.3 everythig works fine.

Regards Daniel