Retrieving exact position of signature boxes

Hi there,


I have the viewer and signature .net libraries and I am looking into whether I can produce a view in which a user could set up a document for signing by outlining areas where signatures are required.

This use case is for when a document requires signatures from multiple users.

I can see the AddLocation() function shows where to initially show the signature when you open a document for signing.

So could I have a screen where I drag 3 different signatures into position and then GET the exact location of those signatures, so that when a user opens the document I can have the signature box already in place and locked down?

So in summary can I retrieve the position of signature boxes from a document in the signature or viewer screen?

And can I then lock signatures to that position inside the signature screen when a user signs?

Hello Sam,

Thank you for your interest in GroupDocs.Signature for .NET.

As we understand the question, you want a “prepare” screen? if so, you can check the “MVCPrepareFieldsFluent” sample from the “GroupDocs.Signature C# Demos” package. There the document and the users are defined in the code-behind, but the fields can be set-up using a prepare screen.

Now what about positions of signatures. Once you drag the fields, set-up them and click “send” (or “sign”) button, all these locations will be added and saved, and afterwards you will be redirected to sign screen. So, once they are saved they can be read in code behind - field property has an array of locations and there will be the added locations with the corresponding coordinates.

But, we are not very sure why you might need that, because the fields that are already added on prepare will be locked on sign.

If you will have more questions please feel free to contact us.

Hi


Thanks for your response.

Yes I want a prepare screen and once the user clicks ok the position of each signature is read in code.

From what I have so far I was returning the document but the signature locations properties of the C# document object were the same as when the document was first loaded even though the signatures have moved around.

I want to use these signature positions that the “preparer” has set up but I don’t want to have to save a prepared document, I want to load the original document and generate the signature locations from the stored variables.

But my problem now is that the FluentSignature.Document object isn’t returning with the updated positions.

Hello Sam,

Thanks for answering.

Unfortunately we are not sure that we can understand what exactly you want to achieve. It seems (but we can be wrong) that what you want is the exact workflow of the sample “MVCPrepareFieldsFluent”, which we mentioned in the previous post.

After starting that sample project you will see the next screen. This screen is what we called a “Prepare screen”. When you click the “Save fields” button, you don’t create or save a “prepared document”, but rather all placed fields are saved to the local JSON database (“groupdocs.signature.documents.json” file).


The workflow that is present in a “MVCPrepareFieldsFluent” project is exactly like this:
1) setup document and recipient in code behind
2) then the user is redirected to a prepare screen where he can add and setup the fields he need
3) once “Save fields” is clicked, the fields that are already setup are saved
4) the user is redirected to a sign screen where he can see the original document with fields he has set up on step 2

"FluentSignature.Document()" method returns a new document instance, like an object-oriented wrapper around the document and its fields. If you want to obtain exact coordinates of the fields from the “prepared” document, you should get this existent document using the next line of code:
Groupdocs.Data.SignatureDocument doc = Groupdocs.Web.UI.Signature.GroupdocsSignature.GetDocument(documentGuid);
This “doc” document has all the properties, including list of fields with list of locations. And on this screenshot you can see where exactly are located document coordinates.

But, as we stated before, maybe we don’t understand something, or your vision, how it should work, is not identical with our vision. So, Sam, please, describe what you want to achieve, step by step, in detail. How you see the workflow, what exactly you require.

Thanks and waiting for your reply.

Hey


Thanks for your help, I managed to get it going, I think the problem I was having was just understanding the flow of the program, the example project is helpful but it doesn’t do a great deal of explaining.

I was wondering however, how the signature fields are tracked before the “save fields” button is clicked.

Basically I want to use jquery to programatically change signature field name properties before the save button is clicked.

I’ve managed to get a pinpoint on the event and element but I can’t track down how to change the actual name of a signature field via code rather than having the user click the field and use the input.

Thanks

Sam

Hello Sam,

Sorry for the delay.

Again, we afraid to understand you incorrect, because you don’t reveal your general, global purpose, what you finally want to do, what you want to achieve. From what we saw, we assume that you want to obtain all information from “prepare screen” programmatically, on the client-side, without clicking the “Save fields” button at all.

On this basis, we can answer the next. Unfortunately GroupDocs.Signature doesn’t have such direct functionality, but here is a workaround for this. If you have your own event you can do something like this:
$("#test-button").on(“click”, function (e) {
$.each($("#groupdocs-signature-prepare .signature_doc_field"), function (index, value) {
var field = ko.contextFor(value).$parents[1];
var location = ko.dataFor(value);

field.name(‘New field name’);
});
});

The “field” variable has the field properties, “location” has the location properties. “ko” is from Knockout.js - GroupDocs.Signature uses this framework for model-view-controller.

If you will have more questions please feel free to contact us.