I'm basing my code on https://cdn.e-iceblue.com/Tutorials/Jav ... -Java.html
When adding visible signature. I have everything, but the viewer say that the Timestamp is from my machine (please see with_cert.png)
- Code: Select all
import com.spire.pdf.interactive.digitalsignatures.PdfSignature;
import com.spire.pdf.interactive.digitalsignatures.PdfSignatureAppearance;
...
// Create a signature maker object to apply the digital signature
PdfOrdinarySignatureMaker signatureMaker = new PdfOrdinarySignatureMaker(document, certificat);
// Get the pdf signature and set the sign details
PdfSignature signature = signatureMaker.getSignature();
... adding data to signature
// Create a signature appearance
PdfSignatureAppearance appearance = new PdfSignatureAppearance(signature);
...adding info to appearance
// Get the first page
PdfPageBase firstpage = document.getPages().get(0);
// Add the signature to a specified location of the page
signatureMaker.makeSignature("Signature", firstpage,
(float) rect.getMinX(), (float) rect.getMinY(),
(float) rect.getWidth(), (float) rect.getHeight(),
appearance);
// and save
When trying to add the Timesamp, as shown in the same page, I change the start of the code to
- Code: Select all
String timeStampUrl = "https://rfc3161.ai.moda/adobe";
PdfPKCS7Formatter formatter = new PdfPKCS7Formatter(certificat, false);
formatter.setTimestampService(new TSAHttpService(timeStampUrl));
// Create a signature maker object to apply the digital signature
PdfOrdinarySignatureMaker signatureMaker = new PdfOrdinarySignatureMaker(document, formatter);
I only get a field so sign, and the content of PDF is not fully present (please see with_formatter.png)
So how do i make this.
Also, how do you set policies when signing so that no change is allowed ?
Regards
Guillaume PATRY