Sends a single-page document to Google Document AI v1beta2 for synchronous (immediate) processing. Returns a response object containing the text and additional data. This function accesses a different endpoint than the main dai_sync() function, one that has less language support, but extracts table data (which dai_sync() currently does not). This function will be deprecated if/when the v1 endpoint incorporates table extraction.

dai_sync_tab(file, proj_id = get_project_id(), loc = "eu", token = dai_token())

Arguments

file

Path to a single-page pdf or image file

proj_id

Your Google Cloud Services project id.

loc

A two-letter region code ("eu" or "us"). Defaults to "eu".

token

An authentication token generated by dai_auth() or another auth function.

Value

a json response object

Details

Requires a Google Cloud access token (google_token) and a certain amount of configuration in RStudio; see vignettes for details. Input files can be in either .pdf, .bmp, .gif, .jpeg, .jpg, .png, or .tiff format. Extract the text from the response object with dai::text_from_dai_response(). Inspect the entire response object with httr::content().

Examples

if (FALSE) { response <- dai_sync("doc_page.pdf") my_page_scan <- "001.png" response <- dai_sync(my_page_scan) }