You do
PdfStamper stp = PdfStamper.createSignature(pdf, oe, '\0');
For earlier signatures to remain valid, though, you have to instantiate a PdfStamper
in append mode:
PdfStamper stp = PdfStamper.createSignature(pdf, oe, '\0', null, true);
(The last parameter selects append mode.)
Cf. the JavaDoc of the latter constructor:
/**
* Applies a digital signature to a document, possibly as a new revision, making
* possible multiple signatures. The returned PdfStamper
* can be used normally as the signature is only applied when closing.
...
* @param append if <CODE>true</CODE> the signature and all the other content will be added as a
* new revision thus not invalidating existing signatures
* @return a <CODE>PdfStamper</CODE>
* @throws DocumentException on error
* @throws IOException on error
*/
public static PdfStamper createSignature(final PdfReader reader, final OutputStream os, final char pdfVersion, File tempFile, final boolean append) throws DocumentException, IOException {