#library(pdftools)
#library(tools)
download_file <- function(url, download_location) {
if (get_ram() < url_size(url)) {
stop('Insufficient Memory to download file')
} else {
curl::curl_download(url, destfile = download_location)
}
}
read_pdf <- function(file_path) {
text <- pdf_text(file_path)
text <- strsplit(text, split = '\n')
text
}
read_pdf_url <- function(url) {
# get tmp file name
tmp_file <- construct_temp_file_name(ext = ".pdf")
# download to tmp file
download_file(url, tmp_file)
#read tmp file
text <- read_pdf(tmp_file)
# remove tmp file
unlink(tmp_file, force = T)
return(text)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.