alkan | Posts: 5

Editable text fields

0 votes
Hi, I am trying to create a document with editable field which user will fill it out. But I cant find how to do it. I have a template pdf which has form fields and injecting Fields with same as pdf form field names.It is working fine but not editable. For below example , | would like signer fill CustomerAddress out. var templatePath = HttpContext.Current.Server.MapPath("abc.pdf"); var documentBuilder= DocumentBuilder.NewDocumentNamed("Direct Debit") .FromFile(templatePath) .WithId("DirectDebitForm") .EnableExtraction() .WithSignature(SignatureBuilder.SignatureFor(ApplicantEmail) .WithName("txtApplicantSignature") .WithPositionExtracted() .WithField(FieldBuilder.SignatureDate() .WithName("txtDateofSignature") .WithPositionExtracted())) .WithInjectedField(FieldBuilder.TextField() .WithName("txtCustomerAddress") .WithValue(CustomerAddress));

Approved Answer
Duo_Liang | Posts: 3776

Reply to: Editable text fields

0 votes
Hi Alkan, In OneSpan Sign, all field types (except signatures) should be binding to signatures, that means text fields will only be flattened into document when the signature was signed. So please put the text field together with your signing date under your signature:
.FromFile(templatePath)
.WithId(“DirectDebitForm”)
.EnableExtraction()
.WithSignature(SignatureBuilder.SignatureFor(ApplicantEmail)
                                          .WithName(“txtApplicantSignature”)
                                          .WithPositionExtracted()
                               .WithField(FieldBuilder.SignatureDate()
                                          .WithName(“txtDateofSignature”)
                                          .WithPositionExtracted())
                               .WithField(FieldBuilder.TextField()
                                          .WithName(“txtCustomerAddress”)
                                          .WithValue("CustomerAddress"))      //as the default value
                                          .WithPositionExtracted())
);
Duo

Duo_Liang | Posts: 3776

Reply to: Editable text fields

0 votes
Hey Alkan, I saw in your code, you were using .WithInjectedField() for your TextField(CustomerAddress) instead of using .WithField() and enabling position extraction. Is there any reason you do so? Because inject field was to flatten values into document before signer starts to sign. And from your description, you just need a normal text field. So from my understanding, you code should be:
......
.WithField(FieldBuilder.TextField()
.WithName(“txtCustomerAddress”)
.WithValue("CustomerAddress"))      //as the default value
.WithPositionExtracted()));
Hope this could help! Duo

alkan | Posts: 5

Reply to: Editable text fields

0 votes
Hi Duo , I have tried it but document builder does not contain a definition for WithField. I can see only WithInjectedField , thay is why I am confused.

Attachments
txtField.jpg55.64 KB
alkan | Posts: 5

Reply to: Editable text fields

0 votes
thank you so much.

Duo_Liang | Posts: 3776

Reply to: Editable text fields

0 votes
Glad to help and feel free to ask any other questions! :)

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off