ropensci / pdftools

Text Extraction, Rendering and Converting of PDF Documents
https://docs.ropensci.org/pdftools
Other
513 stars 69 forks source link

font_info is not working #88

Closed Cdk29 closed 3 years ago

Cdk29 commented 3 years ago

Running :

url <- ('https://www.cell.com/action/showPdf?pii=S1525-0016%2816%2931594-5')
download.file(url, 'Abrams, M T et al 2010.pdf')
pdf_data("Abrams, M T et al 2010.pdf")

Gave the expected output. But :

pdf_data("Abrams, M T et al 2010.pdf", font_info = TRUE)

Output the following :

Error in FUN(X[[i]], ...) : is.data.frame(df) is not TRUE

Cdk29 commented 3 years ago

Commenting df_as_tibble(out) :

pdf_fonts<- function(pdf, opw = "", upw = "") {
  out <- poppler_pdf_fonts(loadfile(pdf), opw, upw)
  #df_as_tibble(out)
}

Solved the issue. And it output a tibble.

Edit : actually df_as_tibble() doest not exist.

jeroen commented 3 years ago

pdf_data has nothing to do with pdf_fonts? It works for me. I think you just didn't install it properly maybe. How did you install?

Cdk29 commented 3 years ago

Omg yes I just realized.

That is odd. I just did devtools::install_github() etc.

Later I run devtools::install() after commenting the change. No update in between.

jeroen commented 3 years ago

You cannot reinstall a package while it is loaded. When you install from source you must be sure to close all your R sessions, and then install in a clean empty r session.

Cdk29 commented 3 years ago

Well I did.

The section was clean when I run devtools::install_github(). In between I restarted the session. Not sure why the first install did not worked.

Cdk29 commented 3 years ago

Never mind, I should not have made debug while being tired, I was updating my own tool to match the new main of pdftools when this happened for some reason. I guess it is a non issue. I will investigate if this occur again. Maybe something due to the compilation of the Cpp code that was already done on this computer that devtools::install_github() did not redo.

Sorry for the non issue and the useless notification.