2009-06-22 63 views
8

我试图使用ABCpdf将包含图像的网页呈现为pdf文档。这是从一个Web应用程序完成的。ABCpdf不在IIS6下呈现Web应用程序中的图像

当我在我的开发机器在IIS5上运行应用程序时,一切都很好。当我在IIS6上部署应用程序时,图像不会显示在pdf中。

要重现该问题,我做了一个简单的Web应用程序,以使从一个简单的网页一个PDF文件,我发现这是不是本地的图像是不会出现在PDF中的人。

与ABCpdf交互相关的代码是:

Doc theDoc = new Doc(); 
theDoc.Rect.Inset(18, 18); 
theDoc.HtmlOptions.PageCacheEnabled = false; 
theDoc.HtmlOptions.PageCacheClear(); 
theDoc.HtmlOptions.UseNoCache = true; 
theDoc.HtmlOptions.Timeout = 60000; 

int theID = theDoc.AddImageUrl(theUrl); 

while (true) 
{ 
    if (!theDoc.Chainable(theID)) break; 
    theDoc.Page = theDoc.AddPage(); 
    theID = theDoc.AddImageToChain(theID); 
} 

for (int i = 1; i <= theDoc.PageCount; i++) 
{ 
    theDoc.PageNumber = i; 
    theDoc.Flatten(); 
} 

theDoc.Save(location); 
theDoc.Clear(); 

,我使用的测试HTML页面是这样的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head><title>Test page</title></head> 

<body> 
<p>This is a local image</p> 
<img src="http://myserver/test/images/testimage.gif" /> 

<p>This is a remote image</p> 
<img src="http://l.yimg.com/a/i/ww/beta/y3.gif" /> 

</body> 
</html> 

所以我想呈现在页面这个网址:http://myserver/test/testpage.html(上面的代码)成pdf。

在IIS6,第二图像(即不是本地服务器)不出现在PDF中。

这似乎是访问权限的问题,但我无法弄清楚。

谢谢。

+0

你有没有找到解决问题的办法? – sptremblay 2010-04-20 19:17:31

回答

2

我也有类似的问题,并发现它是由图像文件过大的尺寸造成的。

3

我知道这有点晚了,但希望能帮助别人!

只是在经历一个非常类似的问题(这是我降落在此页。)。 IIS的版本是相同的,但它在不同的服务器上运行。看起来问题是在图像下载完成之前更多的PDF。

我与WebSuperGoo取得了联系。它使用MSHTML(很好的机会,在你的环境中的差异)和引擎盖下称一对夫妇的建议是尝试:

theDoc.SetInfo(0, "CheckBgImages", "1"); 

theDoc.SetInfo(0, "RenderDelay", "5000"); // You can change this value, just an initial test. 

第二个将延迟渲染PDF,给图像下载的机会。