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

Sometimes map overlay display blank before going into print mode. #134

Closed lqmnhakeem217 closed 6 days ago

lqmnhakeem217 commented 2 months ago

I have developed a printing tool that allows users to print a map with a polygon embedded within it, which can then be inserted into a frame along with additional details. While this project is widely used on a large scale, some users have reported issues where the map image does not appear within the frame when printing. I am investigating the cause of this problem for sometime but I do not know what cause it beside the cloning layer.

The map consist of:

Mind sharing some insight on this issue. thankyou expected result

https://github.com/Igor-Vladyka/leaflet.browser.print/assets/92044826/f2fdf7f8-fdb5-4dbc-ae63-a0b6f5099974

lqmnhakeem217 commented 2 months ago

based on my investigation, it might be the layer render slow, and unable to completely render all tile before it print. is there a way to forcefully render all tile until the tile are loaded then proceed to _completepPrinting function. i dont understand how the clone method works. Please assist 😅

Igor-Vladyka commented 2 months ago

Hey.

You need to debug it and see what is going on. Try next: override: _getLoadingLayers function and try to debug it.

During printing there is a check on all internal layers and wait for them to load, could be that something is breaking in between or for the underlying layer.

lqmnhakeem217 commented 1 month ago

Upon investigating, i realize the issue might be the cookies during print process Screenshot 2024-06-07 112025 as shown in the image. Currently trying to find a way to implement header attribute when printing. If you have any suggestion on how, can you share it here.

lqmnhakeem217 commented 6 days ago

I think I've found the issue. On the production server, the cloned map container's height should be set to 100%, but it's not working correctly and ends up being 0px. For now, I've fixed it by hardcoding the height in pixels until I can find a better solution. I'll close this issue for now, and hopefully, this helps anyone facing the same problem.