I am working with the pdfbox example signature CreateVisableSignature and I would like the code to write the image of the signature into a signature field called "ApplicantSignature" on the third page.
Can someone give a clue as to why it writes the signature in the upper left corner of the first page?
Here is the code:
public static void main(String[] args) throws KeyStoreException,
NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, COSVisitorException,
SignatureException {
if (args.length != 4) {
usage();
System.exit(1);
} else {
File ksFile = new File(args[0]);
KeyStore keystore = KeyStore.getInstance("PKCS12", provider);
char[] pin = args[1].toCharArray();
keystore.load(new FileInputStream(ksFile), pin);
File document = new File(args[2]);
CreateVisibleSignature signing = new CreateVisibleSignature(
keystore, pin.clone());
String jpgFile = CreateVisibleSignature.convertPngToJpeg( args[3] );
FileInputStream image = new FileInputStream( jpgFile );
PDVisibleSignDesigner visibleSig = new PDVisibleSignDesigner(
args[2], image, 1);
visibleSig.xAxis(0).yAxis(0).zoom(-75)
.signatureFieldName("ApplicantSignature");
PDVisibleSigProperties signatureProperties = new PDVisibleSigProperties();
signatureProperties.signerName("name").signerLocation("location")
.signatureReason("Security").preferredSize(0).page(3)
.visualSignEnabled(true).setPdVisibleSignature(visibleSig)
.buildSignature();
signing.signPDF(document, signatureProperties);
}
}
I have also tried:
PDVisibleSignDesigner visibleSig = new PDVisibleSignDesigner(
args[2], image, 3);
visibleSig.xAxis(0).yAxis(0).zoom(-75)
.signatureFieldName("ApplicantSignature");
PDVisibleSigProperties signatureProperties = new PDVisibleSigProperties();
signatureProperties.signerName("name").signerLocation("location")
.signatureReason("Security").preferredSize(0).page(1)
.visualSignEnabled(true).setPdVisibleSignature(visibleSig)
.buildSignature();
And I have tried:
PDVisibleSignDesigner visibleSig = new PDVisibleSignDesigner(
args[2], image, 3);
visibleSig.xAxis(0).yAxis(0).zoom(-75)
.signatureFieldName("ApplicantSignature");
PDVisibleSigProperties signatureProperties = new PDVisibleSigProperties();
signatureProperties.signerName("name").signerLocation("location")
.signatureReason("Security").preferredSize(0).page(3)
.visualSignEnabled(true).setPdVisibleSignature(visibleSig)
.buildSignature();
This is where I want the signature to go on the third page.
This is where it is going on the first page.
These are the field names in the form.