Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

itextsharp HTMLWorker [deprecated]

Tags:

itext

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?)

like image 784
U M A M A H E S H Avatar asked Aug 09 '16 13:08

U M A M A H E S H


1 Answers

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.

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.

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

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 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.

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

like image 152
Bruno Lowagie Avatar answered Oct 14 '22 04:10

Bruno Lowagie