Igor-Vladyka / leaflet.browser.print

A leaflet plugin which allows users to print the map directly from the browser

Home Page:https://igor-vladyka.github.io/leaflet.browser.print/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sometimes map overlay display blank before going into print mode.

lqmnhakeem217 opened this issue · comments

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:

  • multiple TileLayers.wms
  • L.geojson

Mind sharing some insight on this issue. thankyou
expected result

Video.Error.mp4

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 😅

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.

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.

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.