draw_entities {daiR}R Documentation

Draw entity bounding boxes

Description

Plots the entity bounding boxes identified by a Document AI form parser processor onto images of the submitted document. Generates an annotated .png file for each page in the original document.

Usage

draw_entities(
  object,
  type = "sync",
  prefix = NULL,
  dir = getwd(),
  linecol = "red",
  linewd = 3,
  fontcol = "blue",
  fontsize = 4
)

Arguments

object

either a HTTP response object from dai_sync() or the path to a JSON file from dai_async().

type

one of "sync" or "async", depending on the function used to process the original document.

prefix

string to be prepended to the output png filename.

dir

path to the desired output directory.

linecol

color of the bounding box line.

linewd

width of the bounding box line.

fontcol

color of the box numbers.

fontsize

size of the box numbers.

Details

Not vectorized, but documents can be multi-page.

Value

no return value, called for side effects.

Examples

## Not run: 
resp <- dai_sync("page.pdf")
draw_entities(resp)

draw_tokens("page.json", type = "async")


## End(Not run)

[Package daiR version 1.0.0 Index]