Field type for signature field in NodeJs

When I try to run the example https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-node.js/blob/master/test/testSign.ts#L52 it fails because it says the Signature1 field is not found in the sample file sample-input.pdf.

When I run the example Examples/Node.js/Form-Fields/GetAllFields.js it confirms that the file has no form fields at all.

So now I’m trying to run the example Examples/Node.js/Form-Fields/CreateField.js to add a signature field (named ‘Signature1’) to the sample file and I can’t find the correct field type for this. I’ve tried ‘Signature’ and ‘SignatureField’ but I get: “Error: The name ‘Signature1’ doesn’t represent valid signature field or signature field is not empty”

Could you provide a valid JSON fieldBody object for this example to create a signature field please.

Hi,

Thank you for contacting support and sharing details.

I am looking this issue and will update you soon via this thread.

Thanks,

Naeem Akram
Aspose - File Format APIs.

Got a Complaint? File it!

Keep in touch! We’re on Twitter and Facebook

Hi,

You can use ‘sample-input-2.pdf’ as input file. I have also updated SignPdfDoc and GetAllFields examples in Developer Guide as well as at GitHub.

You also need to change .digest(‘base64’) to .digest(‘hex’) in Sign method of ‘node_modules\asposepdfcloud\lib\api-client.js’ file or you can install/download latest package of Aspose.Pdf for Cloud from npm.

For supported field types please visit link field.

If you have any further questions, please feel free to share.

Thanks,

Naeem Akram
Aspose - File Format APIs.

Got a Complaint? File it!

Keep in touch! We’re on Twitter and Facebook

I’ve run the example SignPdfDoc.js and the signature field is updated. However when I click on the completed signature in Adobe Acrobat Reader DC I get the error:

Error during signature verification.

Signature contains incorrect, unrecognized, corrupted or suspicious data.
Support Information: SigDict /Contents illegal data

So now I’m trying to create my own signature field in the sample pdf file and I still can’t see what field type is needed for a signature field. When I follow the link you provide it says:

Available values - text, boolean, integer, list

Which of these should I use for signature fields? Could you provide a valid JSON fieldBody object for the CreateField.js example to create a signature field please.

Hi,

To create a signature field, you need to set field type to 0. It will be like field.type = 0. I have updated Get all Form Fields from the PDF Document example, now this example also return field type which is 0 as input file of this example have signature field.

For working Node.js example of sign pdf document please visit link Sign PDF Documents. You can run Node.js example at your end and output file will be saved at your local system.

If you have any further questions, please feel free to share.

Thanks,

Naeem Akram
Aspose - File Format APIs.

Got a Complaint? File it!

Keep in touch! We’re on Twitter and Facebook

I still can’t create a valid signature field. I’ve tried the following:
var fieldbody = {
‘Name’ : ‘Signature1’,
‘Values’ : [’’],
‘Type’ : 0,
‘Rect’ : {
‘X’ : 10,
‘Y’ : 10,
‘Height’ : 400,
‘Width’ : 600
}
};

It has Type = 0 as suggested. When I try to sign the PDF using this field I get an error:

The name ‘Signature1’ doesn’t represent valid signature field or signature field is not empty.

I’ve tried every variation on Values I can think of to ensure the field is empty, but either the create field fails or the sign document fails. Do you have an example that works?

As regards your screenshot, yes that is the exact same result I’m getting, but did you click on the signature manifest (the blue text)? If you click on it you’ll see the error I reported in my previous. This error is not that important as I’ll be using my own signature field and signature file, but it’s disconcerting when your reference example produces this error.

The important thing for me now is how do I create a signature field in a PDF?

Hi,

Thank you for sharing more details.

I am working on it to create signature filed example and will update you via this thread once this is done.

If you have any further questions, please feel free to share.

Thanks,
Naeem Akram

Hi,

I have added Create Signature Field and Sign Pdf Page examples.

Create Signature Field example create signature field with name ‘Signature1’ on page 1. Once you will run Create Signature Field example, output file with name ‘SignatureField.pdf’ will be save on your local system. Please set output path in config file. Sign Pdf Page example takes ‘SignatureField.pdf’ as input file to sign page 1.

Sign Pdf Document example is used to sign all pages in Pdf document and for this you will have signature field on all pages.

If you have any further questions, please feel free to share.

Thanks,

Naeem Akram

I don’t think you’re creating a signature field here. If you compare the 2 files in the folder https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-node.js/tree/master/testData

  1. sample-input-2.pdf has a signature field: if you click on it it asks you to sign the document.
  2. SignatureField.pdf has a normal text field, not a signature field: if you click on it it allows you to type in text.

Hi,

Both input files field type is Text but I will further check with our product team and will update you via this thread as soon as possible.

If you have any further questions, please feel free to share.

Thanks,

Naeem Akram

Any update? It’s been 2 months now.

@duffyg,

Thanks for your patience and sorry for the delayed response.

We are in coordination with product team and we will share the updates shortly.

Hi Codewarior, thanks for getting back. Just be aware there are 2 problems here:

  1. SignPdfPage.js doesn’t sign the document correctly:
    when I click on the completed signature in Adobe Acrobat Reader DC I get the error:
    Error during signature verification.
    Signature contains incorrect, unrecognized, corrupted or suspicious data.
    Support Information: SigDict /Contents illegal data

  2. CreateSignatureField.js doesn’t actually create a signature field:
    If you compare the 2 files in the folder https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-node.js/tree/master/testData :
    sample-input-2.pdf has a signature field: if you click on it it asks you to sign the document.
    SignatureField.pdf has a normal text field, not a signature field: if you click on it, it allows you to type in text.

@duffyg,

Thanks for sharing the details.

Are you getting the error message with any signature file or it is appearing for certain files ?

This sceanrio is already shared with product team and they are investigating this problem. Soon we will be able to update you with the status of correction.

I’m running SignPdfPage.js which is reading sample-input-2.pdf, signing it with pkc7-sample.pfx and writing the resulting signed PDF to test-signed.pdf. The signature data in test-signed.pdf appears correctly in blue, but when I click on the signature I get the above error in Adobe Acrobat Reader DC.

Is there some other file you’d like me to try? I’ve tested other sample signed PDF files such as from this web site: http://www.tecxoft.com/samples.php

and they work as expected in Adobe Acrobat Reader DC, where a popup confirms the document has not been modified since it was signed etc.

@duffyg,

As per your description above, the issue related to signature validation appears when you are using sample-input-2.pdf file whereas you are not able to see the same problem when using other PDF documents even using the same pkc7-sample.pfx. Please confirm as it will help us in identifying the issue in our enviroment. We are sorry for the delayed response.

I don’t think the problem is the file. I was able to get the Java program AddDigitalSignatureInAPDFFile.java to sign that file with that signature. The only difference is that the Java program doesn’t use the signature field Signature1.

But to answer your question: I have tried to sign only the one PDF document, namely sample-input-2.pdf. I don’t have any other document with a signature field. The cloud API requires a signature field (whereas the Java API does not). I can’t create a signature field with another PDF because of problem number 2.

I mentioned the other PDFs at http://www.tecxoft.com/samples.php because these show how a signed PDF should behave. I have not signed these PDFs. They are already signed.

I added a signature field to another PDF file using Java, but when I submit it:
sample-input-3.pdf (153.5 KB)
to the cloud API for signing (signature field is Signature3) it comes back with the signature field missing completely:
test-signed.pdf (188.9 KB)

@duffyg,

Thanks for sharing the details.

We are now working on testing the scenario based on above description and will keep you updated with our findings.

Any progress on this? Have you replicated the problems? Anything I can do from this end?

@duffyg,

I have logged above stated issue as PDFCLOUD-51 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.