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
155 stars 76 forks source link

Leaflet.browser.print + WMS #95

Closed klaupher closed 4 years ago

klaupher commented 4 years ago

Hi,

Unfortunately, I am not able to make your plugin work with my layers that are generated via WMS. Could you help me? I followed the example below, since all the layers I insert I place in a layerGroup. In this way, I added, at the time of printing, these grouped layers, but even so they do not appear in the printout.


thisMap.on(L.Control.BrowserPrint.Event.PrintStart, function(e) {
    //L.legendControl({position: 'bottomright'}).addTo(e.printMap); origin code
        layerGroup.addTo(e.printMap); // my code
});

Do you have any ideia about this issue??
Regards,
Fernanda
Igor-Vladyka commented 4 years ago

Hello,

I'm not sure how to recreate an issue, can you please provide a demo anywhere (jsbin or anywhere else, or just send a code here) so it be easier to check it out?

Regards, Igor

klaupher commented 4 years ago

Hello,

Sorry for delay in my answer. I was prepare your exemplo... please, access:

http://www.malujuartes.com.br/demoprint/ Thanks a lot.

Igor-Vladyka commented 4 years ago

Hello,

try removing this option, for demo, and let me know to check.

Looks like WMS layer right now attach itself to same base layer, and not to print layer. Therefore removing this option should work or will be easier to debug.

klaupher commented 4 years ago

Sorry, but what's option?? From L.tileLayer.wms?

Igor-Vladyka commented 4 years ago

Sorry, forgot to insert text :) printLayer: googleHybrid image

klaupher commented 4 years ago

I removed the option that you suggested, but it didn't work anyway ... I my project, all layer are grouped together in a LayerGroup.. in this example I put only a layer, but I believe the problem is the same in both cases.

Igor-Vladyka commented 4 years ago

Please also remove this part

    L.Control.BrowserPrint.Utils.registerLayer(L.TileLayer.WMS, 'L.TileLayer.WMS', function (layer) {
        console.info("Printing WMS layer.");
        return abrangenciaOverlay;
    });
klaupher commented 4 years ago

Hi, Igor!! After remove the indicate part,, the print pluging works very well.... Now, I have a problem: why in my principal project it´s not work.. rsrsrs... Well.. Thanks for your huge help...

Regards, Fernanda

Igor-Vladyka commented 4 years ago

Hello again,

It should be straight forward. SOmetimes we overcoplicate stuff when it's not need. Let me know if you need more help.

Regards, Igor