【问题标题】:Websupergoo abcpdf is very slow when generate large pdf from HTML or URL从 HTML 或 URL 生成大型 pdf 时,Websupergoo abcpdf 非常慢
【发布时间】:2017-04-13 12:11:36
【问题描述】:

Websupergoo abcpdf 在从 HTML 或 URL 生成大的 pdf 时非常慢

 Doc theDoc = new Doc();
 theDoc.Page = theDoc.AddPage();
 int theID;
 theDoc.HtmlOptions.UseScript = false;
 theDoc.HtmlOptions.DoMarkup = false;
 theID = theDoc.AddImageHtml(html);
 while (true)
 {
    theDoc.FrameRect(); // add a black border
    if (!theDoc.Chainable(theID))
                break;
    theDoc.Page = theDoc.AddPage();
   theID = theDoc.AddImageToChain(theID);
  }

AddImageHtml 很慢,pdf 是 16 页。

知道如何提高性能吗?

顺便说一句,我尝试使用“AddImageUrl”,但这也很慢。

注意:我使用的是 ABCpdf8。

更新:这里是html要转换为pdf的样本

提前致谢

【问题讨论】:

  • 你好@Rana你能建议你是如何解决这个问题的吗?
  • 升级到版本 10
  • @Rana,我正在调查 ABCpdf10 的类似问题。我每秒获得 2.7 页(1498 页需要 9 分钟)。你花了多长时间?

标签: c# pdf pdf-generation wkhtmltopdf abcpdf


【解决方案1】:

来自 AbcPDF 文档

AddImageHtml 方法 ABCpdf 将此 HTML 保存到一个临时文件中,并使用“file://”协议说明符呈现该文件。所以这是 一种方便的方法 - 它不提供任何性能增强

你试过“分页”参数吗?

theID = theDoc.AddImageUrl(html,true, 300, false);
or
theID = theDoc.AddImageHtml(html,true, 300, false);

尝试使用简单的 HTML。如果它更快,可能你正在解析的网络太复杂了。

编辑:

对于 ABCPdf,16 页不是一个大的 PDF。我已经测试了你的 HTML。我使用过 ABCPDF 的 v8 和 v10。我已经在 2 台机器上测试过它:一台 W10 机器和 WIN XP ...... 我几乎在两者中都得到了PDF。

Abcpdf 正在使用您的环境,因此您必须检查您的 Internet Explorer 版本(尝试将 .htmloptions.engine 更改为 Gecko),或者“生产”HTML 在无效 URL 上具有 css,或者“企业”过滤器” ....

【讨论】:

  • 也试过了,但没有帮助,我相信这与页数有关,因为我试图从小 html 生成 16 个 pdf 页面(每页一个 div),但这很慢好吧 。谢谢
  • 你能告诉你要转换成pdf的网址吗?
  • 我不能提供网址,但这里是 html plnkr.co/edit/w5d1GFjGL4EVDdSTWyQB?p=info
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-30
  • 1970-01-01
相关资源
最近更新 更多