我正在尝试提取〜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")
}
XPDF批处理教程
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)
}