Is it possible to show Google Maps directions in a PDF with DOMPDF? I tried it with the JavaScript Google Maps API and embed the required files and called the function inline, but it doesn't work. Any other solutions?
<script type="text/javascript">
$(document).ready(function() {
initialize();
calcRoute("Innsbruck", "Salzburg");
});
</script>
main.js:
var geocoder;
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(51.764696, 5.526042);
directionDisplay = new google.maps.DirectionsRenderer();
var config = {
zoom: 14,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
}
var map = new google.maps.Map(document.getElementById("map_canvas"), config);
directionDisplay.setMap(map);
directionDisplay.setPanel(document.getElementById("directionsPanel"));
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: "My Location"
});
}
function calcRoute(r_start, r_end) {
var start = r_start;
var end = r_end;
var request = {
origin: start,
destination: end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
}
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionDisplay.setDirections(response);
}
});
}