Few things with html2canvas are not predictable: Below is a screenshot of pdf map.
I am using html2canvas to take a screenshot of google map, and then putting it on pdf by using php.
On the map, before taking the screenshot, the gray shape is not there and all markers have label visible.
Any thoughts / suggestions why it is happening? Like I mentioned earlier, it is unpredictable, sometimes that shape does not show up and sometimes all marker labels are visible.
I notice that the markers without label are put on the map first (when I console.log()). It is happening in html2canvas not after. Below is the vue.js method which grabs the screenshot.
genAndSubmit() {
let xCrop = (this.dimensions.vw - this.dimensions.pw) / 2
this.form.processing = true;
html2canvas(document.querySelector("#mapWrapper"),
{
useCORS: true,
logging: true,
width: this.dimensions.pw,
x: xCrop,
// allowTaint: true,
// foreignObjectRendering: true,
// imageTimeout: 30000,
// scale: 2,
})
.then(canvas => {
this.form.image = canvas.toDataURL('image/png');
this.submit();
});
},
After trying different things here are my solutions:
html2canvas(document.querySelector("#mapWrapper"),{scale: 1.001,})zIndex:9 for the marker.#mapWrapper .gm-style .gm-style-iw-c {box-shadow: none !important;}html2canvas. In my tests, newer version did not display Info Window content.