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/azsdk/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();
    summary

    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/azsdk/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();
    summary

    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();
    summary

    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();
    summary

    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();
    summary

    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();
    summary

    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>

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/azsdk/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();
    summary

    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/azsdk/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();
    summary

    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/azsdk/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();
    summary

    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/azsdk/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();
    summary

    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