How to migrate com.lowagie itext form 2.1.7 to 4.2.0

半腔热情 提交于 2021-02-04 08:40:11

问题


The application I'm working on is using older versions of com.lowagie itext 2.x, now i want to move that to upper version to 4.x, but it looks like several packages are being renamed/removed etc.. I would like to ask if anyone did a migration to 4.x ? If so any suggestions would be great. Thanks in advance


回答1:


There has never been an iText 4.2.0. If you find a version that claims to be iText 4.2.0, then you shouldn't use it because it's in violation with the guidelines of open source. This is explained in this post: My Maven build is broken, what should I do? which was an answer to this StackOverflow question: com.lowagie.itext version 4.2.2 missing jar file in MVNrepository

I quote:

Any other versions of iText between 2.1.7 and 5.0.0, like 4.2.0 and 4.2.1, are forks by other companies. According to Apache's Guide to uploading artifacts to the Central Repository, those companies should have used a different groupId, as the Apache FAQ clearly states:

I have a patched version of the foo project developed at foo.com, what groupId should I use?

When you patch / modify a third party project, that patched version becomes your project and therefore should be distributed under a groupId you control as any project you would have developed, never under com.foo. See above considerations about groupId.

The situation created by the companies that "hijacked" the com.lowagie groupId created a problem where you could inadvertently introduce software that the infringes the copyright or trademarks of third parties (or worse) into your project. To stop this, iText has regained control over com.lowagie and we have made sure that this no longer happens.

If you decide to stick with an old version of iText, you can do so at your own risk.

2.1.7 (July 2009) was the last version of iText released by the company iText Group NV (or its legal predecessor), with the com.lowagie groupId. The next version of iText, released by the company iText Group NV, was version 5.0.0, with the com.itextpdf groupId, which means it's binary incompatible with your current code.

In your question, you are asking how to move from an official version (that should no longer be used in a commercial context for legal and technical reasons) to an unsupported version that is in violations with the guidelines and rules of the open source community. iText 4.2.0 is a gork, it's a version of iText 2.1.7 of which God Only Really Knows what's inside. The only correct answer to the question How to migrate com.lowagie iText from 2.1.7 to 4.2.0 is: You dont! You just don't!

You can migrate to iText 5.5.13, which is the latest version in the iText 5 series. That should be fairly easy. It's mostly a matter of changing com.lowagie into com.itextpdf.

You can also migrate to iText 7.1.1, which is the all new iText version. Migrating to that version requires more programming as iText 7 is a completely new version of iText (rebuilt from scratch). The architecture was changed based on customer requests, so that we can support features that couldn't be inserted into iText 5 (for instance: support for Indic languages such as Devanagari and Tamil).

For your info: I am the Lowagie you refer to when you write com.lowagie.



来源:https://stackoverflow.com/questions/37740725/how-to-migrate-com-lowagie-itext-form-2-1-7-to-4-2-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!