0

We have requirement from client , They would like to add Same Signature in all pages (Know the PDF 2.0 Specification contradicts this one )

I ve succeeded some what(not i desired) in implementing the using Itext7.0.4 and itext 5.X

Using Itext 5.X: : Added " for (int p = 1; p <= writer.reader.getNumberOfPages(); p++) {
writer.addAnnotation(sigField, p); } In PdfSignatureAppearance.java class it worked but in the signature panel on left side is showing only one signature

Ive seen the multiple appearance pdf, shows all pages signature in signature panel.

Kindly tell me is it right way of doing (ignore the PDF 2.0 specification ) and how to show all page signature in signature panel

Using Itext 7.0.4

its working as per https://github.com/mkl-public/testarea-itext7/blob/master/src/test/java/mkl/testarea/itext7/signature/ChangeSignatureAppearance.java

But its a 2 step process 1. creating Invisible signature pdf 2. Adding same signature to all pages

It is possible to do this in single step

If not possible kindly tell me which classes need to change or any work around option .

  • *"In PdfSignatureAppearance.java class it worked but in the signature panel on left side is showing only one signature"* - the reason is that you add the same annotation object (which is merged into the signature field object) to all pages. The annotation, on the other hand, which also has a link to its page. can only point back to a single page. Furthermore, the specification (already ISO 32000-1) does not allow the same annotation object to be used on multiple pages. Thus, instead of merely adding the signature field to each page, you have to create separate widget annotations for each page. – mkl Oct 06 '17 at 09:42
  • Thank you for the response. Could you give some direction r resources on widget exploration (I'm new to itext). Do I need to create multiple widgets in PdfSignatureAppearnce.java file or in user code .One more request, I would like to sign each page separate (that mean different hash for each page -extranal signing may have issue , but I would like to explore this option using etoken ) – Srini Dhulipalla Oct 09 '17 at 04:45
  • @SriniDhulipalla page by page signing isn't really something you can feasibly do in PDF since the page resources(e.g fonts) can be all over the file and are often shared among pages. I'd suggest reading up on the PDF specification to better grasp the problem. – Samuel Huylebroeck Oct 09 '17 at 07:55
  • @SriniDhulipalla *"Do I need to create multiple widgets in PdfSignatureAppearnce.java"* - That's how I'd try that, either by patching that class in iText itself or by deriving from it, doing a bit of injection and reflection here and there. – mkl Oct 09 '17 at 08:59
  • *"I would like to sign each page separate (that mean different hash for each page"* - I assume you want to do that in an interoparable way. Unfortunately the PDF standard does not specify page-by-page signatures. What you can try, though, is putting each page into a separate PDF, sign each of those small PDFs, and then bundle them in a portable collection PDF, arranging settings to make display as much as possible like in a regular PDF.. – mkl Oct 09 '17 at 09:00
  • @mkl, Is it possible to share sample snippet on creating multiple widgets? – Srini Dhulipalla Oct 16 '17 at 11:35
  • @SriniDhulipalla Many years ago I implemented that based on iText 2.1.7. I don't really want to promote the use of that old iText version, so the code would have to be ported to at least 5.5.x which does take some time. – mkl Oct 16 '17 at 13:52
  • @mkl could you share the code snippet based on itext 2.1.7. I will try the with itext 5 . – Srini Dhulipalla Oct 21 '17 at 03:41
  • [Here](https://stackoverflow.com/a/47762053/1729265) there is a solution for iTextSharp, you merely need to port it. – mkl Aug 28 '19 at 15:31

0 Answers0