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

Offset with leaflet map position #122

Closed Tanja000 closed 1 year ago

Tanja000 commented 1 year ago

Area in pdf is not the selected area on the map

Description The map and layers move to another position when I try to print. When I push one of the printing mode buttons, the map moves to another area. The resulting area in the pdf is not the area I choose for printing. Maybe it's a problem with cloning the map? There is a warning: "leaflet.browser.print.min.js?ae42:631 Unknown layer, cannot clone this layer. Leaflet version: 1.9.3". The warning appears even when I print a regular leaflet map (ESRI) without any layers.

I used L.control.browserPrint({position: 'bottomright', title: 'Print ...'}).addTo(map)

To Reproduce

  1. Click on one of the printing modes (landscape, custom ....)

Expected behavior The area in the pdf should be the area that displays on the screen before pushing the print button. In case of mode "custom" it should be the area in selected rectangle.

Desktop (please complete the following information):

Thanks for your great contribution, Igor!

Igor-Vladyka commented 1 year ago

It's not possible to print exactly selected part. printing happens based on a tile size, plugin zooms out to closes tile size that will fit selected section on a page.