代码之家  ›  专栏  ›  技术社区  ›  Jarrett Widman

ASP。NET rdlc,外部图像不显示PDF格式的图像

  •  7
  • Jarrett Widman  · 技术社区  · 16 年前

    我已经确定,如果图像位于我的公共web服务器上,我可以用URL嵌入图像,但当我在localhost中运行时,图像不会嵌入。我已经为localhost确认,如果我将相同的URL粘贴到浏览器中,图像将正常打开。据我所知,我没有代理人。因此,我可以解决我的问题,但我仍然不明白localhost的问题是什么。

    7 回复  |  直到 16 年前
        1
  •  14
  •   Community Mohan Dere    9 年前

    PDF不可能包含外部图像的参考(至少据我所知)。为了使图像出现在PDF中,必须将其嵌入文档中。因此,要使用外部图像,您的应用程序必须检索图像并将其存储在文档中。报表查看器将尝试为您执行此操作。

    第一

    here .

    http://msdn.microsoft.com/en-us/library/ms251715%28VS.80%29.aspx

    使用外部图像 Web.config文件,请确保指定

    <system.net>
    <defaultProxy>
    <proxy usesystemdefault = "false" bypassonlocal = "true" proxyaddress = "http://< proxyservername >:80/" />
    <defaultProxy>
    </system.net>
    

    希望其中一个或两个能有所帮助。

        2
  •  2
  •   Flexo - Save the data dump sunny moon    14 年前

        3
  •  2
  •   pebcakcity    9 年前

    好吧,这就是我们的解决方案。web服务器无法将其自己的合格DNS名称识别为URL,因此我们不得不编辑C:\Windows\System32\drivers\etc文件夹中的Hosts文件,并将主机名添加为localhost。我们添加到文件中的行是:

        4
  •  1
  •   Andre    16 年前

        5
  •  0
  •   Will    16 年前

        6
  •  0
  •   Chris    16 年前

    //For local relative paths
    string imgUrl = new Uri(HttpContext.Current.Server.MapPath("~/images/mylocalimage.jpg")).AbsoluteUri;
    
    // OR
    
    // For complete URLs
    {
        ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // This allows reportViewer to download image from url
        string imgUrl = /* Your image URL ("http://") */;
    }
    //Then pass imgUrl parameter as external source of your image. 
    
    推荐文章