I am trying to access a PDF through an HTTP post request with R Plumber, read it with the tabulizer package, and respond with the PDF in JSON format. I am posting a 53kb PDF through Postman to my route and receiving the error:
Error in normalizePath(path.expand(path), winslash, mustWork).
My R API route code is below:
#' @post /tab
#' @json
function(req){
library("tabulizer")
f <- req$postBody
extract_tables(f)
}
When I use the extract_tables() function with a local path to the PDF that I am using it works perfectly as a get route.
#' @get /tab
#' @json
function(){
library("tabulizer")
f <- "C:/Users/kelse/Desktop/Rscripts/Tessaract/table.pdf"
extract_tables(f)
}
Does anybody know how to post a pdf file through Plumber and access it in a function?