Tm readPDF: Error in file (con, "r"): cannot open connection

I tried the sample code recommended in the tm :: readPDF documentation :

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] } 

But I get the following error (which occurs after calling the function returned by 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 

Note that I installed all xpdf executables in the current directory (but this is due to the if condition).

EDIT: it turned out that this is a mistake. What would be the easiest way?

+1
r pdf-scraping tm
Aug 6 '13 at
source share
1 answer

Was any debugging detected in tm:::pdfinfo() :

 status <- system2("pdfinfo", shQuote(normalizePath(file)), stdout = outfile) 

This command does not create outfile. According to Redirect system2 stdout to a file in windows , this is an error!

+3
Aug 6 '13 at
source share
β€” -



All Articles