0

I am configuring the EasyPrint on my Leaflet map.

enter image description here

My challenge is defining the tileLayer parameter, which I believe is why the preview screen appears blank, not sure what parameter this should be (tileLayer: tiles,).

var printer = L.easyPrint({
            tileLayer: tiles,
            sizeModes: ['Current', 'A4Landscape', 'A4Portrait'],
            filename: 'myMap',
            exportOnly: true,
            hideControlContainer: true
        }).addTo(map);

        function manualPrint () {
            printer.printMap('CurrentSize', 'MyManualPrint')
        }

When I click on the landscape portrait icon the screen is blank and gives the bellow error message in the console (downloaded the dom-to-image.min.js and updated the script, however, the problem remains:

  • Are you running your map from file system or server? From errors it seems you are running it from file system and that's why you receive CORS (cross origin request) error. The only solution for this is to run it from server. – TomazicM Nov 21 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.