在webbrowser控件中打印谷歌地图 - 不会显示路线

 宝贝娜娜121_562 发布于 2023-02-11 14:13

使用IE 11,Windows 8.1.

我将以下内容插入到Windows窗体应用程序中:

 var html = "" +
               "
View Larger Map"; webBrowser1.DocumentText = (html);

现在我想打印这个,但是当我进入printpreview时它没有显示方向线

 private void button1_Click(object sender, EventArgs e)
    {
        this.webBrowser1.ShowPrintPreviewDialog();           
    }

我尝试过不同的浏览器模拟,但仍无法在谷歌地图中打印方向线.IE6 - 11没有运气.

 SetBrowserFeatureControlKey("FEATURE_BROWSER_EMULATION", fileName, GetBrowserEmulationMode());

     public static UInt32 GetBrowserEmulationMode()
    {
        int browserVersion = 7;
        using (var ieKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer",
            RegistryKeyPermissionCheck.ReadSubTree,
            System.Security.AccessControl.RegistryRights.QueryValues))
        {
            var version = ieKey.GetValue("svcVersion");
            if (null == version)
            {
                version = ieKey.GetValue("Version");
                if (null == version)
                    throw new ApplicationException("Microsoft Internet Explorer is required!");
            }
            int.TryParse(version.ToString().Split('.')[0], out browserVersion);
        }

        // Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10.
        UInt32 mode = 11000;

        switch (browserVersion)
        {
            case 7:
                // Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode. Default value for applications hosting the WebBrowser Control.
                mode = 7000;
                break;
            case 8:
                // Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode. Default value for Internet Explorer 8
                mode = 8000;
                break;
            case 9:
                // Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode. Default value for Internet Explorer 9.
                mode = 9000;
                break;


            case 10:
                // Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode. Default value for Internet Explorer 9.
                mode = 10000;
                break;

            default:
                // use IE10 mode by default
                break;
        }

        return mode;
    }

任何人都可以帮我找出为什么这不打印方向线?请记住,直接将此html插入.html文件并使用IE打开,将显示方向线.但他们不打印.

更新

使用IE,您可以将以下内容插入到扩展名为html的文档中.


View Larger Map

这将在firefox中正确打印所有内容.我已经在多台打印机上测试过了.

这在IE中无法正确打印.我尝试过以下方法:

https://support.google.com/maps/answer/21849?hl=en

关于如何让线条出现的任何想法?

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有