Quickstart: Form processing in the console

This quickstart introduces you to Document AI. In this quickstart, you will use the Google Cloud Console to set up your Google Cloud project and authorization, create a form parser, and then make a request for Document AI to process a form PDF document.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud Console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Cloud project. Learn how to confirm that billing is enabled for your project.

  4. Enable the Cloud Document AI API.

    Enable the API

  5. Create a service account:

    1. In the Cloud Console, go to the Create service account page.

      Go to Create service account
    2. Select a project.
    3. In the Service account name field, enter a name. The Cloud Console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. Click the Select a role field.

      Under Quick access, click Basic, then click Owner.

    6. Click Continue.
    7. Click Done to finish creating the service account.

      Do not close your browser window. You will use it in the next step.

  6. Create a service account key:

    1. In the Cloud Console, click the email address for the service account that you created.
    2. Click Keys.
    3. Click Add key, then click Create new key.
    4. Click Create. A JSON key file is downloaded to your computer.
    5. Click Close.
  7. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON file that contains your service account key. This variable only applies to your current shell session, so if you open a new session, set the variable again.

  8. Install and initialize the Cloud SDK.

Create a form parser

Use the Google Cloud Console to create a new form parser:

  1. Open the Document AI dashboard.

    Go to the Document AI dashboard

  2. Click Create processor.

  3. In the Create processor page, select the Form parser option.

    Form parser option in UI

  4. In the side window, name your processor quickstart-form-processor and choose your region.

  5. Click Create. You will be taken to the details page of your newly created form processor.

Send the request to the form parser

After creating your processor you can send annotation requests to it.

  1. Save a local copy of the sample form document (gs://cloud-samples-data/documentai/loan_form.pdf). This document is stored in a publicly accessible Cloud Storage bucket.

  2. In the Test your processor section of the processor detail page, upload the local version of the sample form. This takes you to the document analysis page where you can view the document annotations returned.

    annotated sample form in UI

Clean up

To avoid unnecessary Google Cloud charges, use the Cloud Console to delete your processor and project if you do not need them.

What's next