我正在尝试通过RStudio使用xpdf pdftotext.exe工具将PDF文件转换为txt文件。但是,当我运行代码时,出现警告消息,即:
Warning messages:
1: running command 'C:/Program Files/xpdf-tools-win-4.00/bin64/pdftotext.exe -cfg .xpdfrc C:/Users/gkiyu/Documents/kakao/02802597.pdf C:/Users/gkiyu/Documents/kakao/02802597.txt' had status 127
出现,代码将无法运行。我尝试安装Rtools并将其设置在路径上,但无济于事。评论非常感谢。
我的代码如下:
library(stringr)
pdf_exe <- "C:/Program Files/xpdf-tools-win-4.00/bin64/pdftotext.exe"
pdf_path <- dir("C:/Users/gkiyu/Documents/kakao/", pattern = ".+\\.[pP][dD][fF]", full.names = T)
txt_path <- str_replace(pdf_path, "\\.[pP][dD][fF]", "\\.txt")
command <- str_c(pdf_exe, " -cfg .xpdfrc ", pdf_path, " ", txt_path)
command
system(command)
for(i in 1:length(command)){
system(command[i])
}