How to print Google Map markers

2020-04-08 14:43发布

I am using Google Map Version 3 API to add markers on Google Map.

The problem is that, markers show up on browsers.
but when users print the map through browser's print command, nothing shows up.

The question is, - How can I display markers on printed materials? -

Comparisons:

  • On the browser - markers are clearly visible alt text

  • After Print (IE7, IE8) - markers are not printed (on paper or PDF) alt text

  • After Print (FireFox 3.5.4) - only markers are printed alt text

5条回答
一夜七次
2楼-- · 2020-04-08 14:51

In my print dialog there is a checkbox "print background images". When I enable it, the markers are printed. This link can help you: How can I force browsers to print background images in CSS?

查看更多
混吃等死
3楼-- · 2020-04-08 14:56

I suggest you try out the Static Maps API. You can build a url that will return a static image (you can build your custom markers into the URL).

The browser will do a much better job of printing an image than it will do with a dynamic Google map.

查看更多
淡お忘
4楼-- · 2020-04-08 15:00

Please find the link given below:

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

Using this you will be able to print Google Map along with custom markers.

You only need to make a change at line number 17. Replace container.clone(); with $(container).clone();

查看更多
我只想做你的唯一
5楼-- · 2020-04-08 15:05

I had no issue with printing the markers. I've created my own markers and I use an <IMG> tag to stick the marker icon in.

The markers print fine on IE 8 on default settings.

查看更多
Summer. ? 凉城
6楼-- · 2020-04-08 15:12

I was able to print markers by using MarkerWithLabel in place of Google's Marker class which uses images in place of canvas.

查看更多
登录 后发表回答