Skip to main content

Overview

form_fields() finds every fillable field on each page of a PDF or image: blank lines, empty boxes, tick boxes and signature blanks. Each field has a type, a box, the printed label next to it and, when the label does not say enough, a short descriptive name.

Basic Usage

Form Fields Options

Form Fields Result

Each entry of fields has: A page with error set was not read, or the model repeated itself and its fields may be incomplete.

Fields in the Page Text

A field shows as [type: "name"], with its descriptive name, or its printed label when it has no name. A checkbox shows as [ ] and a radio button as ( ). The data-field-index of an <input> tag in result.json is the position of the field in pages[page]["fields"].

Draw the Boxes

Multiply the fractions by the size of an image of the page, at any resolution. The SDK doesn’t render PDF pages; this sample uses pypdfium2 and Pillow (pip install pypdfium2 pillow). For an image input, open it with Image.open() instead.

Saving the Result

From URL

Async Usage

CLI

The command takes a file or a folder, and the same --page_range, --max_pages and --skip_cache options as the other commands. Add --include_text to get the page text with the fields marked.

Next Steps

Form Fields Recipe

The API, the response format and the options.

Form Filling SDK

Fill the fields you found.

CLI

Process files and folders from the command line.

File Management

Upload, list, and manage files in Datalab storage.