uri <- system.file(file.path("doc", "tm.pdf"), package = "tm")
if(all(file.exists(Sys.which(c("pdfinfo", "pdftotext"))))) {
pdf <- readPDF(control = list(text = "-layout"))(elem = list(uri = uri),
language = "en",
id = "id1")
pdf[1:13]
}
Corpus(URISource(uri),
readerControl = list(reader = readPDF(engine = "ghostscript")))
Run the code above in your browser using DataLab