Leaflet.print icon indicating copy to clipboard operation
Leaflet.print copied to clipboard

(Help) - Error Message

Open renatobecker-zz opened this issue 9 years ago • 11 comments

Hi

I'm trying to use Leaflet.print, but when I click on the print button I get the following message:

"Uncaught TypeError: Cannot read property 'style' of undefined" -> leaflet.print-src.js:827

what's wrong? Thank's

Renato Becker

renatobecker-zz avatar May 21 '15 12:05 renatobecker-zz

Hi Renato

It seems Leaflet Print needs to be updated in order to keep up with the Mapfish Print 3.3 protocol.

andrelsm

andrelsm avatar Oct 09 '15 22:10 andrelsm

Same error%( But I use Geoserver 2.8.0 Is there any way to solve?

error_line:

_showActionsToolbar: function () {
    L.DomUtil.addClass(this._toolbarContainer, 'leaflet-print-actions-visible');
    this._actionsContainer.style.display = 'block'; //THIS LINE GENS ERROR!!!

    this._actionsVisible = true;
},

Jerry-kiwi avatar Nov 19 '15 16:11 Jerry-kiwi

Hi, which version of Leaflet are you using? I haven't done any work to upgrade this plugin to work with Leaflet 1.0 and due to the plugin needing to access private API properties it's quite likely it's not compatible with 1.0

aratcliffe avatar Nov 20 '15 22:11 aratcliffe

0.7.3 from CDN

Jerry-kiwi avatar Nov 21 '15 03:11 Jerry-kiwi

AFAICT that error is occurring in the print control when the print button is clicked before the print service capabilities document has been loaded. Can you check that you're either providing a capabilities configuration object when creating the print provider OR specifying the print service url and autoLoad options, and in the latter case that the capabilities response has returned before clicking the print button.

aratcliffe avatar Nov 21 '15 03:11 aratcliffe

Well, i've found error. It was my fault. thank you

Jerry-kiwi avatar Nov 21 '15 05:11 Jerry-kiwi

I'll update the code to throw an error if the capabilities document hasn't been loaded when the print actions are invoked. That should help with tracking down these issues in the future.

aratcliffe avatar Nov 21 '15 08:11 aratcliffe

Thx... I'm getting now 400 (Bad request) error, when i tru to print the map. Capabilites are loading ok. but request to print

http://82.208.111.22:4040/print-servlet-2.1.0/pdf/print.pdf?spec=%7B%22units%22%3A%22m%22%2C%22srs%22%3A%22EPSG%3A3857%22%2C%22layout%22%3A%22A4%20portrait%22%2C%22dpi%22%3A90%2C%22outputFormat%22%3A%22pdf%22%2C%22outputFilename%22%3A%22leaflet-....

returns 400

is it fault of my server?

Jerry-kiwi avatar Nov 21 '15 08:11 Jerry-kiwi

I would recommend using POST as the HTTP method as the layer data can be quite large. It's possible your HTTP server is truncating the URL.

aratcliffe avatar Nov 21 '15 08:11 aratcliffe

And is there any WORKING example with POST using. I'm getting error "no create.json method"

Thnaks in advance

Jerry-kiwi avatar Mar 15 '16 05:03 Jerry-kiwi

Here's an example from a project we're using Leaflet Print on:

    var printProvider = L.print.provider({
        autoOpen: false,
        map: map,
        capabilities: printConfig,
        proxy: <proxy url> + '?url=',
        method: 'POST',
        layout: 'Map Only',
        dpi: 72,
        outputFormat: 'png'
        }
    }); 

The printConfig global is created by the request to the mapfish print info.json resource:

<script type="text/javascript" src="<map-fish-print>/info.json?var=printConfig"></script>

aratcliffe avatar Mar 15 '16 08:03 aratcliffe