I am currently working with PDF files in R. Specifically, I need to collect information related with hyperlinks embedded in the text of the PDF file. What I have done so far was parsing the PDF file using the pdftools package. Yet, it renders only the text but not the underlying hyperlinks. Below you can find an example of a PDF file with two embedded hyperlinks (the words "sentencia" and "aqui") and the code I have used.
library(dplyr)
txt <- pdftools::pdf_text(pdf = "http://www.corteidh.or.cr/docs/comunicados/cp_47_17.pdf") %>%
paste(., collapse = "") %>%
stringr::str_replace_all("[[:cntrl:]]", " ")
I have also tried:
- the step above also after downloading the files
pdftools::pdf_attachments()which gives me an empty list- as well as
pdftools::pdf_info()also without success.
I could do it by hand but the corpus is quite large and so, before going in that direction, does anybody know how I could identify and extract embedded hyperlinks from PDF files using this package or anything else?
Many thanks!