TransWikia.com

Validity unknown symbol is not being displayed on PDF

Stack Overflow Asked by Divya Agrawal on November 4, 2021

I am using the below c# code (IText7 library) to set the appearance object to show the digital signature on my pdf.

    string destPdf = "D:\UnsignedPDF.pdf";
    string srcPdf = "D:\SignedPDF.pdf";

    PdfReader reader = new PdfReader(srcPdf);
    PdfSigner signer = new PdfSigner(reader,
    new FileStream(destPdf, FileMode.Create),
    new StampingProperties());

    PdfSignatureAppearance appearance = signer.GetSignatureAppearance();
    appearance.SetReason("My reson to sign...")
        .SetLocation("India")
        .SetPageRect(new Rectangle(36, 648, 200, 100))
        .SetPageNumber(1);
    signer.SetFieldName("MyFieldName");

A digital signature is printed on my pdf but not as what I expected, it should show a validity unknown symbol or signature valid symbol but it is not getting printed. I am getting it printed like below image.
enter image description here

but my expectation is to print it like below images:

enter image description here

enter image description here

One Answer

A digital signature is printed on my pdf but not as what I expected, it should show a validity unknown symbol or signature valid symbol but it is not getting printed.

No, it shouldn't.

What you describe is a behavior that has been deprecated in 2003 when Adobe Acrobat 6 has been published. In particular that behavior has never been specified in the ISO PDF specification ISO 32000; on the contrary it has been forbidden in the update ISO 32000-2. For references read this answer.


With respect to iText:

iText(Sharp) 5.x, having inherited its signing API implementation base from iText 2.x/4.x, still offered a backward switch (PdfSignatureAppearance.Acro6Layers) which set to false allowed the creation of signature appearances supporting those in-document validation status marks.

iText 7.x, being a product started in the 2010s, got rid of this burden.

If you happen to work in a context which technologically got stuck in the early 2000s, and if you indeed are required to enable such (nowadays invalid) behavior, you may consider re-integrating the code for generating those pre-Acrobat6 layers in the current iText 7 sign module. If you compare the PdfSignatureAppearance.GetAppearance() source iText 5 and iText 7, you find quickly where with Acro6Layers == false additional layers where added.

Answered by mkl on November 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP