itextsharp HTMLWorker [不建议使用] [英] itextsharp HTMLWorker [deprecated]

查看:172
本文介绍了itextsharp HTMLWorker [不建议使用]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用itextsharp dll(v5.5.9.0)从Asp.net Mvc中的Html生成PDF。在这里,我使用的是类 HTMLWorker 。我得到的结果符合我的要求。现在工作正常。但它显示为 [已弃用] 。将来,它是否会起作用/支持? (或者我可以移动到xmlworker吗?)

I have using itextsharp dll(v5.5.9.0) for generating a PDF from Html in Asp.net Mvc. In this, I am using a class HTMLWorker. I get a result that matches my requirement. It's working fine now. But it shows as [deprecated]. In the future, will it be working/supported or not? (or can I move to xmlworker?)

推荐答案

HTMLWorker 类已弃用。它是作为一个解析小HTML片段的个人项目而开始的。它的编写没有明确的设计。它需要在一个特定项目中服务于个人的目的。

The HTMLWorker class is deprecated. It was started as a personal project to parse small HTML snippets. It was written without a clear design. It needed to serve the purpose of an individual in one specific project.

然而,它以某种方式进入主要版本并且人们开始将它用于它的目的没有建成。人们抱怨错误而不知道 HTMLWorker 从来没有打算做任何繁重的工作。

However, it got into the main release somehow and people started to use it for purposes for which it wasn't built. People complained about bugs without knowing that HTMLWorker was never meant to do any heavy lifting.

其他开发人员开始改进 HTMLWorker 但很快就遇到了有缺陷的设计(以及意粉代码)的限制。

Other developers started improving HTMLWorker but soon hit the limitations of the flawed design (and the spaghetti code).

XML worker是由iText Group支付的开发人员完成的项目。它用于不同的项目。它不是一个URL2PDF工具,因为它无法将复杂的网页转换为PDF,但它允许您使用直接的HTML和CSS创建模板,填充这些模板,并将它们转换为PDF 。

XML worker is a project that was done by developers paid for by iText Group. It is used in different projects. It wasn't meant as an URL2PDF tool, in the sense that it can't convert a complex web page to PDF, but it allows you to create templates using straight-forward HTML and CSS, populate those templates, and convert them to PDF.

XML Worker受到这样的影响,即iText最初并不是为了呈现HTML。例如:在iText 5(和以前的版本)中,不会继承诸如字体,颜色等属性。这些缺陷已在iText 7中修复.XML Worker尚未移植到iText 7,但它是我们技术路线图中的下一个。

XML Worker suffers from the fact that iText initially wasn't meant to render HTML. For instance: in iText 5 (and previous versions), properties such as fonts, colors,... aren't inherited. These flaws are fixed in iText 7. XML Worker hasn't been ported to iText 7 yet, but it's next on our technical road map.

总结: 您不应使用 HTMLWorker 。将来不会支持它。

To summarize: you shouldn't use HTMLWorker. It won't be supported in the future.

这篇关于itextsharp HTMLWorker [不建议使用]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆