Javascript 谷歌地图API v3打印页面出现白线
我用谷歌地图创建了一个页面,我需要打印它,但在地图的某些坐标中,并不是所有出现的位置,都会出现一条白线 HTML代码:Javascript 谷歌地图API v3打印页面出现白线,javascript,html,google-maps,google-maps-api-3,google-static-maps,Javascript,Html,Google Maps,Google Maps Api 3,Google Static Maps,我用谷歌地图创建了一个页面,我需要打印它,但在地图的某些坐标中,并不是所有出现的位置,都会出现一条白线 HTML代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>Google Maps - Teste</title>
<!-- # CSS Imports # -->
<link href="css/site.css" rel="stylesheet">
</head>
<body>
<div id="map"></div>
<!-- # Javascript Imports # -->
<script src="js/site.js"></script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=KEY_GOOGLEMAPS_API&callback=initMap"></script>
</body>
</html>
Javascript代码(js/site.js):
编辑1:
我找到了一个解决办法。。。使用GoogleMaps静态API,发送一些参数,然后返回一个图像,而不是截图。。。请参见编辑2
编辑2:
谷歌地图静态的URL被8192个字符限制,我需要在地图上画很多线。。。所以我回到初始
[###对不起,我的英语不好:(]你能为这个问题提供一个片段或提琴吗。我也有同样的问题。@DanPhilip我尝试过这样做,但我无法让地图显示在提琴上……对不起:(
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
@media print {
img {
max-width: none !important;
}
}
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 9,
center: {
lat: -27.6301719,
lng: -49.0330395
},
mapTypeId: 'terrain'
});
}