Injecting fields
Friday, November 5, 2021 at 01:10pmHello,
I am trying to inject data into a field on a PDF that is uploaded to onespan. I have the field in the following format
[Signer1.Capture1.Textfield1]
the REST API to inject says to use the field names, but the tagging syntax doesn't allow for a name to be added based on the PDF field template found below. do i just put "Textfield1" as the name in the fields section of the documents when sending the package?
https://community.onespan.com/documentation/onespan-sign/guides/feature-guides/developer/document-extraction
Any help would be much appreciated.
if you have a PDF with tagged fields that would work in this case, please attach it as well! :)
Thanks,
Matt
Reply to: Injecting fields
Friday, November 5, 2021 at 01:57pmHi Matt,
Thanks for your post!
Are you looking for an editable field with default value where the signer can modify the value during the Signing Ceremony, versus just to present the value to the signer and stamp the value to the PDF?
Either way, document extraction may not be a good option to accommodate this, because you can't specify the default value for the fields, nor can you create a label field with default value.
On top of document extraction, Text Tags, Position Extraction and Text Anchor features fit these two scenarios. Field Injection also works well if you simply want to stamp the value to the PDF.
Duo
Reply to: Injecting fields
Friday, November 5, 2021 at 02:08pmHi Duo,
We are looking for an editable field with default value where the signer can modify the value during the Signing Ceremony. I looked at the texttags, and it seems like thats only valid for word documents? Do you have examples of it for PDFs?
We want to avoid absolute positioning within the code. And it appears both Position Extraction and Text Anchor function that way.
Reply to: Hi Duo, We are looking…
Friday, November 5, 2021 at 02:14pmHi Matt,
For Text Tags, there's an example PDF in the SDK/Rest tab.
Indeed that with both position extraction and text anchor, you need to at least know the number of fields included in the document and their types, while Text Tags allows the document creator to finish all the design, without coding anything about the field information.
Duo
Reply to: Injecting fields
Friday, November 5, 2021 at 02:29pmThanks Duo!
Text-tag PDF example at https://community.onespan.com/documentation/onespan-sign/guides/feature-guides/developer/text-tag-extraction#tab-header-1
It looks like thats the way we'll need to proceed. Is there a way to set the default values programmatically rather than the "value" attribute within the text tag?
Apologies and thanks for your help.
Reply to: Injecting fields
Monday, November 8, 2021 at 08:33amHi Matt,
In order to set the field value programatically, you can follow below steps:
(1)Define these two text tags:
{{esl_signer1Sig1:Signer1:signature:size(150,40)}} //a click-to-sign signature, with field name/ID of "signer1Sig1", with size of (150,40)
{{esl_signer1Lab1:Signer1:Label:signature("signer1Sig1")}} //a label field binding to "signer1Sig1", with field name/ID of "signer1Lab1"
(2)Create a package with this document, and leave the package status in DRAFT
(3)Invoke a GET call to pull the field metadata:
GET /api/packages/{packageId}/documents/{documentId}/approvals/signer1Sig1/fields/signer1Lab1
Modify the "value" field, and send back with a PUT call
(4)Send the package with call:
POST /api/packages/{packageId}
{"status":"SENT"}
Duo