niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.11k stars 4.75k forks source link

Unable to capture Azure Maps #3081

Open kevicai opened 1 year ago

kevicai commented 1 year ago

When taking a screen shot of an Azure Maps map container element, only html element in the map container shows, but not the map itself. The map in the screen shot is empty.

Code:

 // Get download url
  const mapElem = $("#myMap");
  const canvas = await html2canvas(mapElem);
  return canvas?.toDataURL("image/png").replace("image/png", "image/octet-stream");
donamkhanh commented 11 months ago

Just include below script to forces preserveDrawingBuffer: true https://github.com/greggman/webgl-helpers#webgl-force-preservedrawingbufferjs

QuinnChrest commented 11 months ago

@kevicai were you able to find a solution to screenshotting an Azure Map? @donamkhanh response does not work for me.