rowanwins / leaflet-easyPrint

A leaflet plugin which adds an icon to print the map - Demo @ http://rowanwins.github.io/leaflet-easyPrint/
MIT License
249 stars 138 forks source link

when using option "exportOnly": export directly on click without opening size options #40

Closed barbalex closed 7 years ago

barbalex commented 7 years ago

I am using this great tool with the "exportOnly" option because of the CORS-issues when printing (https://github.com/rowanwins/leaflet-easyPrint/issues/36).

On first use Users will think the export does not work. Because they klick the icon and nothing happens. Only a little unkonwn icon opens. It is not intuitive nor necessary to have to click that icon.

So I will use my own icon and use printMap(size, filename).

This issue is only to suggest to make the export run immediately when "exportOnly" is used.

Feel free to close it if you don't agree.

rowanwins commented 7 years ago

Hi @barbalex

The only thing that you can set that might make things faster is the tileWait parameter, currently it's set to half a second, this ensures that if you're resizing your map the background tiles load otherwise your export looks a bit silly.

The export process itself is also just a bit slow unfortunately. Basically all the dom elements are being converted on to a canvas using dom-to-image, this is where the slowness kicks in I think. This was one of the tradeoffs that allowed me to create a plugin that supports sizing.

Oh and I think the CORS issue will occur with both print mode and export mode, because both use the dom-to-image.

Hope that helps explain things, if you've got any suggestions though I'm open to improving things :)