-5

How do I add a e-signature(persons makes his signature on a tablet) to a PDF using itext in a way a signature is directly added not converted to an image so, eIDAS regulations, basic electronic signature procedure is uphold.

I do not want a digital signature with a certificate only a person signature written on a tablet.

An example would be signosigns app: http://en.signotec.com/portal/seiten/download-signosign-mobile-for-android-900000340-10002.html

Tadej Vengust
  • 1,351
  • 4
  • 18
  • 35
  • Possible duplicate of [Electronic signature PDF Android](http://stackoverflow.com/questions/41360069/electronic-signature-pdf-android) – Amedee Van Gasse Dec 29 '16 at 15:24
  • You already asked exactly the same question yesterday. Edit your original question to add details: http://stackoverflow.com/posts/41360069/edit. Flagging to close. http://stackoverflow.com/questions/41360069/electronic-signature-pdf-android – Amedee Van Gasse Dec 29 '16 at 15:25
  • 1
    Please take a look here http://stackoverflow.com/questions/40461860/how-to-sign-a-pdf-in-android/4059815 . You have accepted an answer that not solves your question *using itext in a way a signature is directly added not converted to an image*. A signature image embedded in a PDF has no legal value at all because can be copied without effort for anybody in any document. Even capturing biometrics is not directly compliant with eIDAS. You will need a protocol in a legal framework to ensure identity, timestamping or non repudiation – pedrofb Dec 29 '16 at 16:10
  • But basic eIDAS says nothing about needing all that information. Adobe acrobat even lets you use a signature from an image so I think it should be enough. And the answer there shows using a certificate which I know I don't need – Tadej Vengust Dec 29 '16 at 16:14
  • Please, read the answer. EIDAS requires identify the signer, integrity of the document and relationship between signer and signature. Extrapolates these concepts to the handwritten signature and thinks if an embedded image fulfills them – pedrofb Dec 29 '16 at 16:20
  • In the link, the certificate is not used to perform the signature of the user. It is proposed to timestamp the result in server to ensure the date and time the user made the signature – pedrofb Dec 29 '16 at 16:24
  • The signosign software you reference as example [here](http://en.signotec.com/products/signature-software/signosign-mobile-for-android/) clearly indicated that it protects the signature image using a digital signature. This contradicts what you say it is an example for. – mkl Dec 30 '16 at 03:11
  • The installation guide actually indicates that two distinct certificates can be configured and that demo certificates are provided by default. – mkl Dec 30 '16 at 03:21

1 Answers1

0

Use itext pdfstamper to write the signature.

FileOutputStream os = new FileOutputStream(destFileName);
PdfStamper stamper = new PdfStamper(reader, os);

Where reader is the sec file reader then once you have got the stamper.

PdfPatternPainter painter = stamper.getOverContent(1).createPattern(200, 150);
painter.setColorFill(BaseColor.ORANGE);
painter.beginText();
painter.setTextMatrix(AffineTransform.getTranslateInstance(0, 50));
painter.setFontAndSize(BaseFont.createFont(), 70);
painter.showText(waterMarkString);
painter.endText();

for (int i = reader.getNumberOfPages(); i > 0; i--) {
    PdfContentByte overContent = stamper.getOverContent(i);
    overContent.setColorFill(new PatternColor(painter));
    overContent.rectangle(200, 300, 200, 150);
    overContent.fill();
}

Set the text and dimensions and then.

reader.close();
stamper.close();
os.close();

Then close the reader, stamper and outputstream.

The signature would be displayed.

Jaydip
  • 592
  • 5
  • 27
prashant
  • 1,382
  • 1
  • 13
  • 19
  • Ok, but from the code I cannot detect where or in what form would I add the signature.. Since it has to be drawn by the user, I am guessing I would need to capture it with canvas or in similar way but from what I see here you would can only add it as a string in showtext or am I missing something? – Tadej Vengust Dec 29 '16 at 15:19
  • you can replace the text with the canvas class toString method......to display the signature – prashant Dec 29 '16 at 15:27
  • The signosign app clearly mentioned as example in the question uses a digital signature to protect the signature image. The code in this answer clearly doesn't. – mkl Dec 30 '16 at 03:24