Spring pdf generation

2019-09-08 15:53发布

问题:

I am using spring 3 AbstractPdfView in order to generate PDF files. I noticed Spring does not use the new version of iText (5.x.x) but uses an older version (2.1.7).

  1. Why does spring does not use the new package?
  2. Where can I find documentation for the old package? I don't seem to find it anywhere.

回答1:

There is an other big problem with the newer versions of IText: they changed the licence.

  • the old IText was LGPL or Mozilla Public License (till Java 2.1.7 and C# 4.1.6)
  • the actual IText is: GNU Affero General Public License AGPL - (some customized kind of GPL) (since 5.0.0)

So at least Spring can not include IText 5.0.0 (like many other not GPL open source projects)

by by IText - zu Geld gierig



回答2:

Your problem is because of the change in the iText structure . Check here for a discussion on this subject. Basically you will have to extend AbstractView like AbstractPdfView and do whatever you need.