如何在“打印”中查看Google地图模式? [英] How to view Google Maps in "print" mode?

查看:192
本文介绍了如何在“打印”中查看Google地图模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Google Maps API第2版,而且我想在Google地图页面上打印地图。

I'm using the Google Maps API v2 and I'd like to be able to print the map the same way as Google does on its Maps page.

您可以单击小打印机图标,它创建一个新的弹出窗口与相同的地图,但所有的不可打印的东西(如控件)被取出。
我知道他们使用 @media print 在导航器中点击打印预览或打印来实现这个效果。但是,弹出式窗口不处于打印模式。

You can click the little printer icon and it creates a new popup window with the same map but all the unprintable stuff (like the controls) is taken out. I know that they use @media print to achieve that effect when you hit "Print preview" or "Print" in the navigator. However, the popup window isn't in print mode.

有没有办法做他们正在做的魔术,例如设置当前的媒体类型为打印?

Is there any way of doing the magic trick they're doing, like setting the current media type to "print"? Or or they cheating and setting a custom CSS style cheat?

我在同一页面上有一个Silverlight插件和一个Google地图,我希望能够创建

I've got a Silverlight plugin and a Google Map on the same page and I want to be able to create a popup window containing just the map ready for printing (like Google is doing).

感谢您使用 http://abcoder.com/google/google-map-api/print-button-for-google-map -api / 我知道如何获取HTML内容,但我只能获取其上的所有控件等内容(我不想要的)。

Thanks to http://abcoder.com/google/google-map-api/print-button-for-google-map-api/ I know how to get the HTML content but I can only get the content with all the controls etc on it (which I don't want).

任何帮助将不胜感激。

推荐答案

Google地图放置一个类 gmnoprint 在所有的元素,他们不想打印..所以设置为 display:none 在您的打印css文件或弹出窗口将隐藏它们..



Google maps put a class gmnoprint on all elements that they do not want to print .. so setting this to display:none in your print css file or popup window will hide them ..

.gmnoprint{
  display:none;
}

当然,这将隐藏google认为不打印的。 。如果你想选择其他项目,你必须以某种方式解析他们的html代码:(

Of'course this will hide whatever google deems as not-for-printing.. If you want to select other items you will have to somehow parse their html code :(

这篇关于如何在“打印”中查看Google地图模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆