Search code examples
javapdfdigital-signature

Generate pdf empty signature fields free for commercial use


Is there any java lib that I can use (Itext is not free to use for commercial sites) to generate empty digital signature fields in java from servlets or jsp . I must have more than one empty signature field generated . Php has TCPDF , is there something similar in java .


Solution

  • As there was no answer but the JasperReports one yet (and it can be considered an overkill to use a full-blown reporting suite just to add an empty signature field to a document), I'm consolidating my comments as a second answer here:

    You want to to generate empty digital signature fields in java but don't want to use iText because it is not free to use for commercial sites.

    1. If you merely want to create empty signature fields and it is not important to be state-of-the-art concerning the many additions and bug fixes in newer versions of iText, you can consider using the latest iText version published under LGPL, i.e. 2.1.7 or (the unofficial) 4.2.0. There are some minor fixes in the latter one as compared to the former one, so you might want to prefer that version.

      In that case I would propose you check out the SVN branch in question and build it yourself instead of using one of the versions built by some third parties because some of them include undocumented changes.

    2. I am sure that you can somehow do that with PDFBox, too, because that library exposes the low level objects of PDFs it processes quite publicly. As I'm not really into that library, I cannot tell how to do that in detail. You can simply take some PDFBox samples creating form fields, consult the PDF specification ISO 32000-1:2008, and implement it, it should not be too difficult.

    3. A newer player among the free PDF libraries is PDF Clown. According to its doc, it doesn't deal with signatures yet. It does work with form fields and general annotations, though, so it should not be difficult to add the functionality required by you, either --- empty signature fields actually are very simple form fields, the cryptographic fun does not start before actually signing a PDF, either using an empty signature field or creating a new one on the fly.

      In this case you might have to change the lib itself while in case of PDFBox I assume you can simply use the lib. But you may be able to fascinate Stefano Chizzolini, the PDF Clown creatror, to integrate that change.

    All this being said, I do agree with Bruno's comment that anyone making profit (commercial use) by using a library created by someone else (iText in the case at hand) should not restrain from somehow sharing, either by sharing his code (i.e. using iText according to the AGPL) or by paying for iText.

    Of course, there sometimes are adverse constraints, e.g. a management very slow to allow sharing but very quick to demand realization from its dev staff... <sigh>