Open OliverHamann1027 opened 4 years ago
Leider kann ich den Fehler nicht reproduzieren (MacOS, R Version 4.0). Beim Laden von pdftools wird angezeigt, dass poppler-Version 0.73.0 genutzt wird. Welche Version sehen Sie? Welche Version von pdftools nutzen Sie?
Ein Hinweis auf ein mögliches Problem
files <- list.files(pattern = "pdf$")
NOTE: the code above only works if you have your working directory set to the folder where you downloaded the PDF files. A quick way to do this in RStudio is to go to Session…Set Working Directory.
Link: https://data.library.virginia.edu/reading-pdf-files-into-r-for-text-mining/
Wenn das Arbeitsverzeichnis (working directory) identisch sein muss mit dem Verzeichnis, in dem das pdf-Dokument liegt, dann könnte das hier funkionieren.
library(pdftools)
afd_btw2017 <- "https://cdn.afd.tools/wp-content/uploads/sites/111/2017/08/AfD_Wahlprogramm_2017_A5-hoch.pdf"
afd_btw2017_local <- tempfile()
download.file(url = afd_btw2017, destfile = afd_btw2017_local)
getwd() # das wird nicht das temporäre Verheichnis sein
setwd(tempdir()) # Arbeitsverzeichnis setzen!
pdftools::pdf_info(afd_btw2017_local)
txt <- pdftools::pdf_text(afd_btw2017_local) # Fehlermeldungen
Das Wahlprogramm der AfD zur Bundestagswahl 2017 kann nicht geladen werden.
pdftools::pdf_info(afd_btw2017_local)
Fehler: PDF error (3490): Illegal character '{' PDF error: xref num 367 not found but needed, try to reconstruct<0a> $version