iTextSharp的HTMLWorker IMG没有发现404

问题描述:

我得到了HTMLWorker.ParseToList函数将抛出一个异常(404 - 未找到)的问题时,类似这样的标记:iTextSharp的HTMLWorker IMG没有发现404

<img alt="none" src="/image.jpg" /> 

先后在src.I”一个Deadlink中d喜欢它只是不加载图像,并继续。

有没有人现在有办法来配置这个或有类似的解决方案?

您可以扩展HTMLWorker以包含一个过滤器,以便在将HTML传递到扩展的HTMLWorkerParseToList()方法之前删除(或替换)所需的任何HTML元素。

路径必须是绝对的例如:C:\影像\ image.jpg的

您可以

Server.MapPath(relativeUrl) 

看看做这个线程

http://www.draggerco.com/node/2

的伟大工程对我来说...

我刚换掉

string siteUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.AbsolutePath, ""); 

string siteUrl = HttpContext.Current.Server.MapPath([your_path_for_images_in_string]); 

**注:对于这一点,使用HtmlWorker.Parse()方法

我'固定。但是这个;

C:\影像\ image.jpg的为localhost:3524 \影像\ image.jpg的

<img alt="none" src="http://localhost:3524/image.jpg" /> 

创建主机配置。

html = html.Replace("img src=\"", "img src=\"http://localhost:3524"); 

它的措辞。