Hi Aspose Support Team,
I am currently using SignatureCustomAppearance
in Aspose.PDF to customize the digital signature appearance in a signed PDF. My objective is to completely remove the DigitalSubjectFormat from the signature. Below is my configuration:
SignatureCustomAppearance appearance = new SignatureCustomAppearance();
appearance.setUseDigitalSubjectFormat(true);
appearance.setDigitalSignedLabel(“Testing signature”);
appearance.setDigitalSubjectFormat(new int[]{});
appearance.setShowContactInfo(false);
appearance.setShowLocation(false);
appearance.setShowReason(false);
However, after applying this configuration, the digital signature text appears as: Testing signature"
AsposeSignIssue.PNG (11.4 KB)
It seems that an extra double quote ("
) is being appended at the end of the text.
Questions:
- How can I completely remove DigitalSubjectFormat without affecting the display?
- Is there a way to prevent or remove the extra double quote (
"
) from appearing in the digital signature?
I would appreciate any guidance or recommendations on resolving this issue. Please let me know if you need any additional details.
Looking forward to your response.
@WaseemMuthu
To address your issues with the SignatureCustomAppearance
in Aspose.PDF, here are some suggestions:
-
Removing DigitalSubjectFormat: To completely remove the DigitalSubjectFormat
from the signature without affecting the display, you should set the UseDigitalSubjectFormat
property to false
. This will prevent the digital subject format from being applied to the signature. Here’s how you can modify your code:
SignatureCustomAppearance appearance = new SignatureCustomAppearance();
appearance.setUseDigitalSubjectFormat(false); // Set to false to remove DigitalSubjectFormat
appearance.setDigitalSignedLabel("Testing signature");
appearance.setShowContactInfo(false);
appearance.setShowLocation(false);
appearance.setShowReason(false);
-
Preventing Extra Double Quote: The extra double quote at the end of your signature text may be caused by how the DigitalSignedLabel
is being processed. Ensure that there are no unintended characters or formatting in the string you are using. If the issue persists, consider checking if there are any additional settings or properties that might be affecting the output.
If you continue to experience issues, it may be helpful to review the documentation or examples related to digital signatures in Aspose.PDF to ensure that all configurations are set correctly.
If you need further assistance, please provide additional details about your implementation or any error messages you encounter.
Sources:
No specific sources were referenced in this response.
Even i setUseDigitalSubjectFormat(false), the DigitalSubjectFormat will still appears in the signature.
@WaseemMuthu
We are looking into it and will be sharing our feedback with you shortly.
@WaseemMuthu
Have you used 25.1 version of the API and if possible, could you please share your sample input/output file(s) for our reference as well? We will test the scenario in our environment and address it accordingly.
Yes, I am using version 25.1. I was testing with any PDF file to apply a digital signature. Please check the attached image to see the signature output which is still showing the DigitalSubjectFormat even I have set ‘setUseDigitalSubjectFormat(false)’.
image.png (5.8 KB)
Please help to provide the solution ASAP. Thanks 
@WaseemMuthu
We need to investigate this issue in details. That is why we requested for your sample file(s). Can you please share them along with the complete sample code snippet so that we can use it to replicate the issue in our environment and address it accordingly.
Hi , please see the below sample code snippet and the generated output file from the code.
testAsposeSignature.pdf (536.9 KB)
public void asposeSignaturePdf() {
String inputPdf = "testAspose2.pdf";
String outputPdf = "testAsposeSignature.pdf";
String pfxFile = "output.pfx";
String pfxPassword = "1234";
try {
Document doc = new Document(inputPdf);
// Initialize PdfFileSignature
PdfFileSignature signature = new PdfFileSignature(doc);
// Specify the rectangle for the signature
java.awt.Rectangle rect = new java.awt.Rectangle(50, 50, 500, 100);
// Use the PFX for signing
PKCS1 pkcs = new PKCS1(pfxFile, pfxPassword);
SignatureCustomAppearance appearance = new SignatureCustomAppearance();
appearance.setDigitalSignedLabel("Testing Signature");
appearance.setUseDigitalSubjectFormat(false);
appearance.setShowContactInfo(false);
appearance.setShowLocation(false);
appearance.setShowReason(false);
pkcs.setCustomAppearance(appearance);
signature.sign(1, true, rect, pkcs);
signature.save(outputPdf);
} catch (Exception e) {
LOG.error("Failed to sign PDF", e);
throw new RuntimeException("PDF signing failed", e);
}
}
@WaseemMuthu
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFJAVA-44777
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Can I check how we can confirm whether the fix has been delivered, as we don’t know when it will be implemented?
@WaseemMuthu
The ticket status can be checked at the bottom of this forum thread. Along with that, we will also send you a notification as soon as the ticket is resolved. It will be prioritized on first come first serve basis as per free support policies and once it is resolved, you will be informed. Please be patient and spare us some time.
We are sorry for the inconvenience.