我已经尝试了tm::readPDF 文档中推荐的示例代码:
library(tm)
if(all(file.exists(Sys.which(c("pdfinfo", "pdftotext"))))) {
uri <- system.file(file.path("doc", "tm.pdf"), package = "tm")
pdf <- readPDF(PdftotextOptions = "-layout")(elem = list(uri = uri),
language = "en",
id = "id1")
pdf[1:13]
}
但我收到以下错误(在调用返回的函数后发生readPDF
):
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:\DOCUME~1\Tomas\LOCALS~1\Temp\RtmpU33iWo\pdfinfo31c2bd5762a': No such file or directory
请注意,我已将所有 xpdf 二进制文件安装到当前目录(但这由if
条件处理)。
编辑:发现这是一个错误。什么是最简单的解决方法?