我能够在 map 上指向标记,并且它在浏览器中可见。但是当我打印相同的内容时,标记在 map 上不可见。请帮忙。
<button class="map-print" ng-click="mapprint();">print</button>
[enter image description here][1]<script>
function mapprint(){
var content = document.getElementById('map_div'); //has to be first.
content.style.position = "relative";
content.style.height = contents.firstChild.offsetHeight + "px";
content.style.width = contents.firstChild.offsetWidth + "px";
var win = window.open();
win.document.write(content.innerHTML);
win.print();
win.close();
}
我得到了 map 的打印件。但是无法加载 map 标记
这是我的网页 View
这是我的 map 打印 View
最佳答案
Google Maps JavaScript API 不支持打印。看看官方常见问题解答中的以下答案
https://developers.google.com/maps/faq#print
Printing from the JavaScript API is not supported. This is because printing support is inconsistent across commonly used browsers. We recommend using the Static Maps API for printing purposes.
关于javascript - 打印时加载 map 标记问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44386581/