Add extract anchor to a new document on an existing package
Friday, August 5, 2016 at 06:36amHey there,
I have a situation where I have an existing package and I'm trying to add a new document to it with text anchor fields.
The part to create the document is fine, but my issue is to add an extract anchor to it.
From what I've seen, the SDK offers the option to
sdk.createDocuments(String packageId,Map. This works fine, I'm able to add the documents to the package, but then the only way for me to add a signature to those documents, is to do it in a different call withdocumentBlobMap)
sdk.addSignature(packageId, docId, approval);This is blocking me to add the extract anchor, because based on this documentation EsignLive Document Extraction :
Text anchor extraction is available only in the API call that uploads the document. It is not available in subsequent calls.Here is how I'm doing it :
ESignLiveSDK sdk = new ESignLiveSDK(); //Get the package ESignLiveAPIObjects.Package_x pkg = sdk.getPackage(packageId); //Set the status to draft sdk.setStatus(packageId, ESignLiveAPIObjects.PackageStatus.DRAFT); //Here I'm deleting everything that was in the package (signers, documents, approvals, fields, ...) //And I Create a new document from a SF page PDF Blob document = new PageReference('test').getContentAsPDF(); Map String, Blob > blobMap = new Map String, Blob > (); blobMap.put('document1', document); //Creating a field and an achor List ESignLiveAPIObjects.Field > fields = new List ESignLiveAPIObjects.Field > (); ESignLiveAPIObjects.ExtractAnchor ea1 = new ESignLiveAPIObjects.ExtractAnchor(); ea1.text = 'myText'; ea1.index = 0; ea1.width = 180; ea1.height = 40; ea1.anchorPoint = ESignLiveAPIObjects.AnchorPoint.TOPLEFT; ea1.characterIndex = 0; ea1.leftOffset = -90; ea1.topOffset = -45; ESignLiveAPIObjects.Field field1 = new ESignLiveAPIObjects.Field(); field1.width = 150; field1.height = 40; field1.extractAnchor = ea1; field1.type = 'SIGNATURE'; field1.subtype = 'FULLNAME'; fields.add(field1); //Creating the role (signer ) ESignLiveAPIObjects.Role role = sdk.addRole('guilaume', 'test', '[email protected]',packageId); //Create the approval List ESignLiveAPIObjects.Approval > approvals = new List ESignLiveAPIObjects.Approval > (); ESignLiveAPIObjects.Approval approval = new ESignLiveAPIObjects.Approval(); approval.role = role.name; approval.fields = fields; approvals.add(approval); //My issue is starting here. At this point I need to create the document in esign, so I'm using the following method : String addDocResponse = sdk.createDocuments(packageId, blobMap); //And then im adding the approval to the document. This part is done after the document creation, because I //need the document Id to add the approval to it String addSignatureResponse = sdk.addSignature(packageId, docId, approval); System.debug('=> Response from addSignature: ' + addSignatureResponse);Let me know how it would be possible to add the extract anchor on a new document in one call with the Apex SDK (without creating a new package) :) PS : I also tried to do the following :
ESignLiveAPIObjects.Document doc1 = new ESignLiveAPIObjects.Document(); doc1.name = 'document1'; doc1.approvals = new ListBut this is still not taking the extract anchor fields in consideration. Thank you, Guillaume{approval}; pkg.documents = new List {doc1}; pkg.roles = new List {role}; sdk.updatePackage(ESignLiveAPIObjects.Package_x packageToUpdate, String packageId); String response = sdk.createDocuments(packageId,blobMap);
Reply to: Add extract anchor to a new document on an existing package
Monday, August 8, 2016 at 01:39pmReply to: Add extract anchor to a new document on an existing package
Thursday, August 11, 2016 at 07:47amReply to: Add extract anchor to a new document on an existing package
Friday, September 30, 2016 at 06:22amReply to: Add extract anchor to a new document on an existing package
Friday, September 30, 2016 at 11:46am