1
我已經試過了example code recommended in the tm::readPDF documentation連接:TM readPDF:文件錯誤(CON,「R」):無法打開
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
條件處理)。
編輯:發現這是一個錯誤。什麼是最簡單的解決方法?
簡單的解決方法:http://stackoverflow.com/questions/17979074/error-trying-to-read-a-pdf-using-readpdf-from-the-tm-package/17981259#17981259 – Ben