Forum Stats

  • 3,840,396 Users
  • 2,262,599 Discussions
  • 7,901,263 Comments

Discussions

Sign PDF Document

Hello,

I found some code using oracle.xdo library to sign PDF documents and it's working :

    String inPDF = "/tmp/PDFDigitalSignatureTest_1.pdf";

    String outPDF = "/tmp/PDFDigitalSignatureTest_1_signed.pdf";

    String pkcs12File = "/tmp/sample.pfx";

    try

    {

      PDFSignature pdfSignature = new PDFSignature(inPDF, outPDF);

      Properties props = new Properties();

      // adds some properties to props

      pdfSignature.setConfig(props);

      pdfSignature.setLocale("en");

      pdfSignature.init("password4PKCS12", pkcs12File);

      // pdfSignature.addSignatureField(1, new float[]{550, 780, 620, 800}, "Signature1");

      pdfSignature.sign("Signature1", "I'm the author of this document");

      // Once it's signed, the cleanup() method must be called.

      // Otherwise, some resources will not be released.

      pdfSignature.cleanup();

    }

    catch(Throwable t)

    {

      t.printStackTrace();

    }

The PDF is well signed and the signature appears in the PDF, but I need to know if we can customise the skinning of the signature in the signed pdf, because it's bad looking how it appears now, just a simple box having the name of the pkcs12 file.

Ragards.

Tagged:
This discussion has been closed.