Open bcm-afalco opened 7 years ago
Hi @Audinetta123
Unfortunately this is probably a CORS issue related to the use dom-to-image
under the hood (similar to lots of previous issues). Do you know if you're tile provider has headers set to allow cross origin requests?
Hello, I have headers set to * in allow cross origin requests
Hi @Audinetta123
Are you able to post your tile layer url so I can take a quick look? If you dont want to make it public you can drop me an email at rowanwins at yahoo dot come dot au
Even the demo (http://rowanwins.github.io/leaflet-easyPrint/) doesn't work on the latest FireFox :-(
Thanks for the report @AlexKwak I'll try and take a look, I was hoping that dom-to-image
was going to help make this plugin lots more robust but it's not looking like it at the moment :(
Hi,
I fixed this issue with modify tile output.
By default, tiles output as <img>
. I changed to <div>
with background-image
style and it works.
L.TileLayer.ShowAsDiv = L.TileLayer.extend({
createTile: function (coords, done) {
var tile = document.createElement('div');
if (this.options.crossOrigin) {
tile.crossOrigin = '';
}
tile.style.backgroundImage = "url('"+this.getTileUrl(coords)+"')";
tile.style.visibility = 'inherit';
return tile;
},
});
L.tileLayer.showAsDiv = function(args) {
return new L.TileLayer.ShowAsDiv(args);
};
tileLayer = L.tileLayer.showAsDiv( YOUR_TILES_URL, { YOUR_OPTIONS }).addTo(map);
Hey @romanrehacek
That is awesome, thanks for sharing! I'll give it a bit of a test and have a think about how I could feasibly incorporate it.
I also wonder if the tilelayer crossOrigin
option might be helpful here, I've never looked into it so dropping a mental note to take a squiz... possibly a deadend but worth a shot
Hi,
The export was working OK in Firefox V55.0.1 and after a recent update, I am now experiencing an issue in the export of the base layers (leaflet map). I have attached an image of the result I am getting. Can you help? Thanks