title: R script - PDF error: Illegal character in hex string; when I am searching for keywords
body: <p>I am trying to count the number of keywords in multiple pdf files. </p>
  
  <pre><code>library(tm)
  library(pdftools)
  
  files &lt;- list.files(pattern = "pdf$")
  Rpdf &lt;- readPDF(control = list(text = "-layout"))
  corp &lt;- Corpus(URISource(files), readerControl = list(reader = Rpdf))
  
  words &lt;- c("example", "keyword", "test")
  dt &lt;- DocumentTermMatrix(corp, control=list(dictionary=words))
  </code></pre>
  
  <p>When I run the code I always get this errors:</p>
  
  <pre><code>PDF error: May not be a PDF file (continuing anyway)
  PDF error (3): Illegal character &lt;21&gt; in hex string
  PDF error (5): Illegal character &lt;4f&gt; in hex string
  PDF error (7): Illegal character &lt;54&gt; in hex string
  PDF error (8): Illegal character &lt;59&gt; in hex string
  PDF error (9): Illegal character &lt;50&gt; in hex string
  PDF error: Couldn't find trailer dictionary
  PDF error: Couldn't find trailer dictionary
  PDF error: Couldn't read xref table
  Error in poppler_pdf_text(loadfile(pdf), opw, upw) : PDF parsing failure.
  In addition: There were 12 warnings (use warnings() to see them)
  </code></pre>
  
  <p>If you have any suggestions, please let me know. Thank you!</p>