Google Map Image not loading on PDF

1.7k Views Asked by At

I am working on functionality which is converting html to PDF in Symfony2. Everything written in html like images/texts are displaying on newly genrated PDF but the google map is not displaying on PDF. I am plotting map from below script.

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
}); }

Having below div into my html.

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

Map is loading into the html But not displaying on PDF. Its showing empty space. Please HELP.

1

There are 1 best solutions below

1
On

I can able to displayed google map with marker on PDF as:

<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>

EDIT : Static Maps images can be returned in any size up to 640 x 640 pixels.

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