我正在尝试将填充了表格的~600个pdf文件提取到文本格式,以便我可以进行一些数据探索。看起来pdftool是我完成工作的最佳选择,但帮助文件很简短。我找到的最接近的教程使用xpdf。有没有办法用pdftools做到这一点?
library("pdftools")
folder <- file.path("C:\\Users\\adarvishian\\Documents\\MEGA\\Consular
Affairs\\Visa Statistics\\Scrape")
folder
length <- length(dir(folder))
length
dirpdf <- dir(folder)
dirpdf[1]
for(i in 1:length(dir(folder)))
{
text <- pdf_text("C:\\Users\\adarvishian\\Documents\\MEGA\\Consular
Affairs\\Visa Statistics\\Scrape")
}
答案 0 :(得分:0)
library("pdftools")
folder <- file.path("C:\\Users\\adarvishian\\Documents\\MEGA\\Consular
Affairs", "Visa Statistics", "Scrape")
folder
length <- length(dir(folder))
length
dirpdf <- dir(folder)
dirpdf[1]
pdftotxt <- "C:\\Users\\adarvishian\\Documents\\R\\otherpackages\\xpdf-
tools-win-4.00\\xpdf-tools-win-4.00\\bin64\\pdftotext.exe"
for(i in 1:length(dir(folder)))
{
pdf <- file.path("C:\\Users\\adarvishian\\Documents\\MEGA\\Consular
Affairs\\Visa Statistics", "Scrape", dirpdf[i])
system(paste("\"", pdftotxt, "\" \"", pdf, "\"", sep = ""),wait = F)
}