【问题标题】:ABCpdf doesn't render images in an web application under IIS6ABCpdf 不在 IIS6 下的 Web 应用程序中呈现图像
【发布时间】:2010-11-04 21:57:56
【问题描述】:

我正在尝试使用 ABCpdf 将包含图像的网页呈现为 pdf 文档。这是通过 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>

所以我正在尝试将这个 url 处的页面:http://myserver/test/testpage.html(上面的代码)呈现为 pdf。

在 IIS6 中,第二个图像(不是服务器本地的)不会出现在 pdf 中。

似乎是访问权限的问题,但我想不通。

谢谢。

【问题讨论】:

  • 您找到解决问题的方法了吗?
  • 不。该项目无论如何都被放弃了......

标签: iis-6 abcpdf


【解决方案1】:

我知道这有点晚了,但希望能对其他人有所帮助!

刚刚遇到了一个非常相似的问题(这就是我登陆此页面的方式..)。 IIS 的版本相同,但它在不同的服务器上运行。看起来问题是在图像下载完成之前生成了更多的 PDF。

我与 WebSuperGoo 取得了联系。据说它使用 MSHTML(很有可能这就是您的环境的不同之处),并且有几个建议是尝试:

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

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

第二个将延迟呈现 PDF,让图像有机会下载。

【讨论】:

    【解决方案2】:

    我也遇到过类似的问题,发现是图片文件过大造成的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-20
      • 2010-10-23
      • 1970-01-01
      • 1970-01-01
      • 2022-11-26
      • 1970-01-01
      • 1970-01-01
      • 2020-09-21
      相关资源
      最近更新 更多