Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

Accessing custom method from signatureservice is not working #40

Open
atirtahirgroupdocs opened this issue Aug 3, 2020 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@atirtahirgroupdocs
Copy link

This issue is raised here https://forum.groupdocs.com/t/digital-signature-application-compatibility-with-internet-explorer-using-spring-java/7898/48.

Hi,

  1. User cloned groupdocstotal-angular project and copied signature and common-components folder into my project as per the advanced scenario mentioned here
  2. To render the uploaded document, user called super.selectFile() in custom component
  3. Now, user wants to access a method called sign() in signatureservice but not sure how to achieve this

Have a look at this screenshot.
image (2)

Summary:
Have a look at the attached code (code.txt). User is able to successfully render the document by calling selectFile() method. User wants to modify few things in this service sign() from SignatureService.ts and call it explicitly in my Component. Have a look at this image.
sign How can we do it?. Please assist.
code.txt

@Pavel-Teplitsky
Copy link

Pavel-Teplitsky commented Dec 14, 2020

Hi @atirtahirgroupdocs thank you for your question.

To customize sign action try the following:

  1. Create a custom document signing action.
    For example:
 signDocument() {
//this.prepareSignaturesData() is taken from parent component 
    const signatures = this.prepareSignaturesData();
//this.credentials.password is taken from parent component
    this.password = this.credentials.password;
    const docType = FileUtil.find(this.currentFile.Name).format;
//this.guid - is a file name or any other string data to determine which file is currently signing
    this._appService.sign(this.guid, signatures, docType, this.password).subscribe((file: any) => {
    //do something with responce
    });
  }
  1. Create custom action to send sign document API call.
    In the code example from step 1 it's a _this._appService.sign()_ action.
    For example:
  sign(documentGuid: string, signatures: any[], fileType: string, password: string) {
    return this._http.post(this._config.getProductsApiEndpoint() + urlToApiAction, {
      guid: hash,
      password: password,
      signaturesData: signatures,
      documentType: fileType,
    }, Api.httpOptionsJson);
  }
  1. Set this action to sign button in html template like shown on the screenshot above.
    screenshot

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants