How to do multi level digital signature in pdf document using c# and enterprise license cost of aspose.pdf

Hi,
Please let me know sample code in Aspose.pdf to do multilevel signature in a pdf document without invalidating previous signature. Signature should apply to input pdf.
Let me know the enterprise license cost which I can use in our proprietary product.
Looking for prompt response.
Thanks
Rasmi Ranjan Mishra

@rasmi.mishra

Can you please specify the version of Aspose.PDF you are using and if you have any specific requirements for the multi-level digital signature implementation?

You suggest me which version I should use for my proprietary product along with sample code and license cost .
Requirement is to apply multi level digital signature to input pdf file.

@rasmi.mishra

Please allow us to gather related details and share it with you here.

@rasmi.mishra

Please check and use below code snippet to achieve your requirements:

using (var doc = new Aspose.Pdf.Document(dataDir + "doc.pdf"))
{
    using (var pdfFileSignature = new PdfFileSignature(doc))
    {
        var pkcs = new PKCS1(dataDir + "R_password_111111.pfx", "111111");
        string Contact = "Yourself";
        string Reason = "Contract";
        string Location = "Catalonia";
        pdfFileSignature.Sign(1, Reason, Contact, Location, false, new System.Drawing.Rectangle(10, 10, 100, 100), pkcs);
        pdfFileSignature.Save(dataDir + "docsignCompany.pdf");
    }
}

using (var doc = new Aspose.Pdf.Document(dataDir + "docsignCompany.pdf"))
{
    using (var pdfFileSignature = new PdfFileSignature(doc))
    {
        var pkcs = new PKCS1(dataDir + "R_password_111111.pfx", "111111");
        string Contact = "Yourself";
        string Reason = "Contract";
        string Location = "Catalonia";
        pdfFileSignature.Sign("FIRMA1", Reason, Contact, Location, pkcs);
        pdfFileSignature.Save(dataDir + "docsignWorker.pdf");
    }
}

Hi Ali,
Thanks for the code example, following code does not give any error but I could not see any signature added to output document .Please let me know on this. I am doing POC to use Aspose for for a new project
Thanks
Rasmi Ranjan Mishra

@rasmi.mishra

Can you please share the sample source and output PDF document for our reference? Also, please share the certificate files that you are using. We will test the scenario in our environment and address it accordingly. Please also make sure that you are using a valid or 30-days free temporary license while evaluating the API.

Hi Ali,
PFA the sample project where I have not included package folder and cleaned bin and debug folder.
pdfsign - POC.zip (767.0 KB)
Attaching output file -
Doc1.pdf (1.3 MB)

Source code description : It has Aspose.pdf reference from nuget package.Sample certificate is available in Certificate folder. Password of certificate is in code.
Input file is in Docs folder and same file will be updated as output file .
Please le me know on this.
Thanks
Rasmi Ranjan Mishra

@rasmi.mishra

We checked the output PDF that you have shared in Adobe Reader and it is showing that two signatures were added into it.
image.png (84.0 KB)

We have also noticed that it was created using trial version of the API. As shared and requested before, please try to evaluate the API with a temporary 30-days free license in order to prevent the trial versions limitations.

Hi Ali,
Thanks for your response.
I have couple of queries here .
1.How to make my signature visible inside a signature box with any signature pattern ?In your attached screenshot the rev 2 signature looks invisible, when I am looking for it to be visible with a proper signature style.
2.When I apply the 2nd signature then the first signature becomes invalid . I need to keep multiple signatures by multiple people in an incremental way which will be signed at different time . How do I achieve this using Aspose.pdf ?
Appreciate your response
Thanks
Rasmi Ranjan Mishra

@rasmi.mishra

For that, you need to have a signature field inside PDF document on which you can add signatures:

Document doc = new Document(dataDir + "input.pdf");
            
var editor = new FormEditor();
editor.BindPdf( dataDir + "input.pdf");

for (int page = 1; page <= doc.Pages.Count; page++)
{
    editor.AddField(FieldType.Signature, "Signature", page, 360, 430, 480, 380);
}
            
editor.Save( dataDir + "output.pdf");

Can we use same project that you shared above to replicate this issue? OR did you test using some other method again?

Hi Ali,
I have updated and attached the same project for incremental signature.
pdfsign - POC1.zip (397.4 KB)
Code description : Signer1 will sign the document with his certificate cert1 and save the document . Signer2 will open the document and sign using his certificate cert2 and save the document.
In the attached output document doc2.pdf the 1st sign gets invalid when 2nd signer signs .
doc2.pdf (1.3 MB)

Please suggest me how to keep both signatures valid, it would be great if you keep both signatures in separate box as visible while responding with some sample code for fix
Thanks
Rasmi Ranjan Mishra

@rasmi.mishra

We noticed this issue in our environment as well that one signature becomes invalid if we add two signatures in the PDF. Therefore, its been logged as PDFNET-58223 in our issue tracking system for further analysis and correction. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Ali,
Thanks for taking up this, When can I expect to hear from you with a fix. I am about to start the project giving the quote for Aspose license . Any timeline will help me to manage my planning
Thanks
Rasmi Ranjan Mishra

@rasmi.mishra

We are afraid that we cannot share any ETA or timeline yet because issues are prioritized on first come first serve basis as per free support policies. However, we have logged your concerns along with the ticket and will surely inform you once we make any progress in this regard. Please spare us some time.

We are sorry for the inconvenience.