Javascript DOMPDF和谷歌地图方向
是否可以使用DOMPDF以PDF格式显示谷歌地图的方向?我用JavaScript Google Maps API尝试了它,嵌入了所需的文件并调用了内联函数,但它不起作用。还有其他解决办法吗Javascript DOMPDF和谷歌地图方向,javascript,php,google-maps,dompdf,Javascript,Php,Google Maps,Dompdf,是否可以使用DOMPDF以PDF格式显示谷歌地图的方向?我用JavaScript Google Maps API尝试了它,嵌入了所需的文件并调用了内联函数,但它不起作用。还有其他解决办法吗 <script type="text/javascript"> $(document).ready(function() { initialize(); calcRoute("Innsbruck", "Salzburg"); }); </scr
<script type="text/javascript">
$(document).ready(function() {
initialize();
calcRoute("Innsbruck", "Salzburg");
});
</script>
使用谷歌静态地图是可能的,但您将无法在@Mathis Hü动态更改地图ttl@simon听起来不错,我不想动态更改地图。如何嵌入方向?通过iframe?阅读此链接@Mathis Hüttl@simon有没有可能用静态贴图得到这样的效果?dompdf无法处理JavaScript,因此无法呈现标准的Google地图界面。对于类似的东西,您可以使用无头浏览器,例如。
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);
}
});
}