How to print Google Map markers

11,516

Solution 1

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.

Solution 2

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

Solution 3

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?

Share:
11,516
dance2die
Author by

dance2die

I like to read, and build(& break?) stuff. Currently helping folks out on r/reactjs & DEV#react. Reach out to me @dance2die & check out my blog on sung.codes

Updated on June 04, 2022

Comments

  • dance2die
    dance2die almost 2 years

    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

  • dance2die
    dance2die over 13 years
    Unfortunately, when I construct static map URL, URL becames too long to be processed.
  • Ankit Sharma
    Ankit Sharma over 13 years
    That is unfortunate. Static Maps has a maximum URL length of 2048 characters. The docs mention that you should check you are encoding the URL correctly. code.google.com/apis/maps/documentation/webservices/… Maybe worth checking. Good luck.
  • dance2die
    dance2die over 13 years
    Due to the printing issue, i deserted Google map over Bing map (silverlight version), which works fabulously well
  • Luke Pittman
    Luke Pittman almost 9 years
    Could you give some insight in how to use this?
  • Zusee Weekin
    Zusee Weekin about 8 years
    I tried this but not working. Can you please include a code sample?