draw_tokens | R Documentation |
Plots the token (i.e., word) bounding boxes identified by Document AI (DAI) onto images of the submitted document. Generates an annotated .png file for each page in the original document.
draw_tokens(
object,
type = "sync",
prefix = NULL,
dir = getwd(),
linecol = "red",
linewd = 3,
fontcol = "blue",
fontsize = 4
)
object |
either a HTTP response object from
|
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. |
Not vectorized, but documents can be multi-page.
no return value, called for side effects.
## Not run:
resp <- dai_sync("page.pdf")
draw_tokens(resp)
draw_tokens("page.json", type = "async")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.