使用多边形打印Google Maps API v3地图

Jaw*_*ame 4 javascript google-maps google-maps-api-3

我正在尝试打印使用Google Maps API v3创建的地图.地图包含一个多边形.我正在使用弹出方法尝试打印它:

var gmapPrint = function() {
  var content = window.document.getElementById('map-canvas') // get you map details
  var newWindow = window.open(); // open a new window
  newWindow.document.write(content.innerHTML); // write the map into the new window
  newWindow.print(); // print the new window
} 
Run Code Online (Sandbox Code Playgroud)

地图打印得很好,但缺少多边形.起初,似乎在地图上绘制多边形之前弹出了打印对话框,所以我添加了一个setTimeout.这并没有解决问题.我也尝试过使用静态地图API,但是我的多边形边界中的点数超过了最大URL大小,即使在编码时也是如此.

有人有这个成功吗?

Jaw*_*ame 6

好的,所以Beetroot-Beetroot的评论让我走上正轨.我之前看过那篇文章并给了它一个没有太多运气的快速拍摄,但现在我已经开始工作了.

这是一个打印谷歌地图而不显示控件的片段.

https://gist.github.com/jawsthegame/6801698