Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
tm readPDF:文件中有错误(con,“r”):无法打开连接_R_Tm_Pdf Scraping - Fatal编程技术网

tm readPDF:文件中有错误(con,“r”):无法打开连接

tm readPDF:文件中有错误(con,“r”):无法打开连接,r,tm,pdf-scraping,R,Tm,Pdf Scraping,我已经试过了: 请注意,我已将所有xpdf二进制文件安装到当前目录(但这是由if条件处理的) 编辑:发现这是一个bug。最简单的解决方法是什么?进行了一些调试,并在tm::pdfinfo(): 状态简易解决方案: library(tm) if(all(file.exists(Sys.which(c("pdfinfo", "pdftotext"))))) { uri <- system.file(file.path("doc", "tm.pdf"), package = "tm")

我已经试过了:

请注意,我已将所有xpdf二进制文件安装到当前目录(但这是由
if
条件处理的)


编辑:发现这是一个bug。最简单的解决方法是什么?

进行了一些调试,并在
tm::pdfinfo()
:

状态简易解决方案:
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]
}
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
status <- system2("pdfinfo", shQuote(normalizePath(file)), 
        stdout = outfile)