Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FormRecognizerClient

Package version

Client class for interacting with the Azure Form Recognizer service.

Hierarchy

  • FormRecognizerClient

Index

Constructors

constructor

Properties

endpointUrl

endpointUrl: string

URL to an Azure Form Recognizer service endpoint

Methods

beginRecognizeBusinessCards

  • Recognizes data from business cards using a pre-built business card model, enabling you to extract structured data from business cards such as name, job title, phone numbers, etc.

    For a list of fields that are contained in the response, please refer to the documentation at the following link: https://aka.ms/formrecognizer/businesscardfields

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const path = "./business-card-english.png";
    const readStream = fs.createReadStream(path);
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeBusinessCards(readStream, {
      contentType: "image/png",
      onProgress: (state) => { console.log(`status: ${state.status}`); }
    });
    
    const [businessCard] = await poller.pollUntilDone();

    Recognizes business card information from a given document

    Parameters

    Returns Promise<FormPollerLike>

beginRecognizeBusinessCardsFromUrl

  • Recognizes business card information from a url using a pre-built business card model, enabling you to extract structured data from business cards such as name, job title, phone numbers, etc.

    For a list of fields that are contained in the response, please refer to the documentation at the following link: https://aka.ms/formrecognizer/businesscardfields

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const url = "<url to the business card document>";
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeBusinessCardsFromUrl(url, {
      includeFieldElements: true,
      onProgress: (state) => {
        console.log(`analyzing status: ${state.status}`);
      }
    });
    const [businessCard] = await poller.pollUntilDone();

    Recognizes business card information from a given accessible url to a document

    Parameters

    • businessCardUrl: string

      Url to a business card document that is accessible from the service. Must be a valid, encoded URL to a document of a supported content type.

    • Default value options: BeginRecognizeBusinessCardsOptions = { includeFieldElements: false }

      Options for the recognition operation

    Returns Promise<FormPollerLike>

beginRecognizeContent

  • Recognizes content, including text and table structure from a form document.

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed. Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const path = "./Invoice_7.pdf";
    const readStream = fs.createReadStream(path);
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeContent(readStream, "application/pdf", {
      onProgress: (state) => { console.log(`status: ${state.status}`); }
    });
    
    const pages = await poller.pollUntilDone();

    Recognizes content/layout information from a given document

    Parameters

    Returns Promise<ContentPollerLike>

beginRecognizeContentFromUrl

  • Recognizes content, including text and table structure from a url to a form document.

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed. Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const url = "<form document url>";
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeContentFromUrl(url, {
      onProgress: (state) => { console.log(`status: ${state.status}`); }
    });
    
    const pages = await poller.pollUntilDone();

    Recognizes content/layout information from a url to a form document

    Parameters

    • formUrl: string

      Url to a document that is accessible from the service. Must be a valid, encoded URL to a document of a supported content type.

    • Default value options: BeginRecognizeContentOptions = {}

      Options for the content recognition operation

    Returns Promise<ContentPollerLike>

beginRecognizeCustomForms

  • Recognizes forms from a given document using a custom form model from training.

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const path = "./Invoice_6.pdf";
    const readStream = fs.createReadStream(path);
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeCustomForms(modelId, readStream, "application/pdf", {
      onProgress: (state) => { console.log(`status: ${state.status}`); }
    });
    const forms = await poller.pollUntilDone();

    Recognizes form information from a given document using a custom form model.

    Parameters

    Returns Promise<FormPollerLike>

beginRecognizeCustomFormsFromUrl

  • Recognizes forms from a URL to a document using a custom form model from training.

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const url = "<form document url>";
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeCustomFormsFromUrl(modelId, url, {
      onProgress: (state) => { console.log(`status: ${state.status}`); }
    });
    const forms = await poller.pollUntilDone();

    Recognizes form information from a url to a document using a custom form model.

    Parameters

    • modelId: string

      Id of the custom form model to use

    • formUrl: string

      Url to a document that is accessible from the service. Must be a valid, encoded URL to a document of a supported content type.

    • Default value options: BeginRecognizeCustomFormsOptions = {}

      Options for the recognition operation

    Returns Promise<FormPollerLike>

beginRecognizeIdentityDocuments

  • Recognizes data from identification documents using a pre-built ID document model, enabling you to extract structured data from ID documents such as first/last name, document number, expiration date, and more.

    For a list of fields that are contained in the response, please refer to the documentation at the following link: https://aka.ms/formrecognizer/iddocumentfields

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const path = "./license.jpg";
    const readStream = fs.createReadStream(path);
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeIdentityDocuments(readStream, {
      onProgress: (state) => { console.log(`status: ${state.status}`); }
    });
    
    const [identityDocument] = await poller.pollUntilDone();

    Parameters

    Returns Promise<FormPollerLike>

beginRecognizeIdentityDocumentsFromUrl

  • Recognizes identity document information from a url using pre-built ID document model, enabling you to extract structured data from ID documents such as first/last name, document number, expiration date, and more.

    For a list of fields that are contained in the response, please refer to the documentation at the following link: https://aka.ms/formrecognizer/iddocumentfields

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const url = "<url to the identity document>";
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeIdentityDocumentsFromUrl(url, {
      includeFieldElements: true,
      onProgress: (state) => {
        console.log(`analyzing status: ${state.status}`);
      }
    });
    
    const [identityDocument] = await poller.pollUntilDone();

    Parameters

    • identityDocumentUrl: string

      Url to an identity document that is accessible from the service. Must be a valid, encoded URL to a document of a supported content type.

    • Default value options: BeginRecognizeIdentityDocumentsOptions = {}

      Options for the recognition operation

    Returns Promise<FormPollerLike>

beginRecognizeInvoices

  • Recognizes data from invoices using a pre-built invoice model, enabling you to extract structured data from invoices such as customer address, vendor address, purchase order ID, etc.

    For a list of fields that are contained in the response, please refer to the documentation at the following link: https://aka.ms/formrecognizer/invoicefields

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const path = "./Invoice_1.pdf";
    const readStream = fs.createReadStream(path);
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeInvoices(readStream, {
      contentType: "application/pdf",
      onProgress: (state) => { console.log(`status: ${state.status}`); }
    });
    
    const [invoice] = await poller.pollUntilDone();

    Recognizes invoice information from a given document

    Parameters

    Returns Promise<FormPollerLike>

beginRecognizeInvoicesFromUrl

  • Recognizes invoice information from a URL using a pre-built invoice model, enabling you to extract structured data from invoices such as customer address, vendor address, purchase order ID, etc.

    For a list of fields that are contained in the response, please refer to the documentation at the following link: https://aka.ms/formrecognizer/invoicefields

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const url = "<url to the invoice document>";
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeInvoicesFromUrl(url, {
      includeFieldElements: true,
      onProgress: (state) => {
        console.log(`analyzing status: ${state.status}`);
      }
    });
    const [invoice] = await poller.pollUntilDone();

    Recognizes invoice information from a given accessible url to a document

    Parameters

    • invoiceUrl: string

      Url to an invoice document that is accessible from the service. Must be a valid, encoded URL to a document of a supported content type.

    • Default value options: BeginRecognizeInvoicesOptions = {}

      Options for the recognition operation

    Returns Promise<FormPollerLike>

beginRecognizeReceipts

  • Recognizes data from receipts using a pre-built receipt model, enabling you to extract structured data from receipts such as merchant name, merchant phone number, transaction date, and more.

    For a list of fields that are contained in the response, please refer to the documentation at the following link: https://aka.ms/formrecognizer/receiptfields

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const path = "./contoso-allinone.jpg";
    const readStream = fs.createReadStream(path);
    
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeReceipts(readStream, {
      contentType: "image/jpeg",
      onProgress: (state) => { console.log(`status: ${state.status}`); }
    });
    
    const [receipt] = await poller.pollUntilDone();

    Recognizes receipt information from a given document

    Parameters

    Returns Promise<FormPollerLike>

beginRecognizeReceiptsFromUrl

  • Recognizes receipt information from a url using pre-built receipt model, enabling you to extract structure data from receipts such as merchant name, merchant phone number, transaction date, and more.

    For a list of fields that are contained in the response, please refer to the documentation at the following link: https://aka.ms/formrecognizer/receiptfields

    This method returns a long running operation poller that allows you to wait indefinitely until the operation is completed.

    Note that the onProgress callback will not be invoked if the operation completes in the first request, and attempting to cancel a completed copy will result in an error being thrown.

    Example usage:

    const url = "<url to the receipt document>";
    const client = new FormRecognizerClient(endpoint, new AzureKeyCredential(apiKey));
    const poller = await client.beginRecognizeReceiptsFromUrl(url, {
      includeFieldElements: true,
      onProgress: (state) => {
        console.log(`analyzing status: ${state.status}`);
      }
    });
    const [receipt] = await poller.pollUntilDone();

    Recognizes receipt information from a given accessible url to a document

    Parameters

    • receiptUrl: string

      Url to a receipt document that is accessible from the service. Must be a valid, encoded URL to a document of a supported content type.

    • Default value options: BeginRecognizeReceiptsOptions = {}

      Options for the recognition operation

    Returns Promise<FormPollerLike>

Generated using TypeDoc