谷歌地图图像不加载PDF

Google Map Image not loading on PDF

本文关键字:PDF 加载 图像 谷歌地图      更新时间:2023-09-26

我正在Symfony2中将html转换为PDF的功能上工作。所有用html写的东西,比如图像/文本都显示在新生成的PDF上,但谷歌地图不显示在PDF上。我从下面的脚本绘制地图。

function initializeMap( ) {
var mapOptions = {
        zoom: 17,
        center:  new google.maps.LatLng(propLatLng.lat(), propLatLng.lng()),
        mapTypeId: google.maps.MapTypeId.ROADMAP
};
googleMap = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var marker = new google.maps.Marker({
    position: propLatLng,
    map: googleMap,
    title: propAddress
}); }

有下面的div到我的html。

<div id="map_canvas"  style="width:900px;height:700px;"></div>

地图正在加载到html中,但不显示在PDF中。它显示了空白的空间。请帮助。

我可以在PDF上显示带有标记的谷歌地图:

<div class="print-show">
<img src="http://maps.googleapis.com/maps/api/staticmap?center=yourLatitude,yourLongitude&zoom=16&scale=false&size=900x600&maptype=roadmap&format=png&visual_refresh=true&markers=size:mid|color:red|label:|yourLatitude,yourLongitude"/>
</div>

编辑:静态地图图像可以以任何大小返回,最大640 x 640像素。

https://developers.google.com/maps/documentation/maps-static/intro