I'm trying to embed a google map into a landscape PDF, but somehow, wkhtmltopdf always cuts the map in two parts although the map would fit on one page easily.
I think the problem is, that the map is built with tiles. The tiles are bigger than the map and are cut off, but wkhtmltopdf seems to ignore this and thinks that the cut off tiles also must fit onto the page...
Here's some sample code to reproduce this:
<html>
<head>
<script src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script>
window.onload = function(){
var fenway = new google.maps.LatLng(47.188563,8.480487);
var gmap = new google.maps.Map(document.getElementById("map"),{
center: fenway,
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
});
var marker = new google.maps.Marker({
position: fenway,
map:gmap
});
google.maps.event.addListener(gmap,"tilesloaded",function(){
window.status = "ready";
});
}
</script>
</head>
<body>
<div id="map" style="width:1500px;height:800px"></div>
</body>
</html>
And the command to convert it to PDF:
wkhtmltopdf --window-status ready --orientation landscape map.html map.pdf
I'm using the latest version of wkhtmltopdf by the way...
Is there a possibility to make the map fill the page without the cut?