Is it possible to read/convert PDF portfolios in R?
I usually use pdftools
, however, I get an error:
library(pdftools)
#> Using poppler version 0.73.0
link <- c("http://www.accessdata.fda.gov/cdrh_docs/pdf19/K190072.pdf")
pdftools::pdf_convert(link, dpi = 600)
#> Converting page 1 to K190072_1.png...
#> PDF error: Non conformant codestream TPsot==TNsot.<0a>
#> PDF error: Non conformant codestream TPsot==TNsot.<0a>
#> PDF error: Non conformant codestream TPsot==TNsot.<0a>
#> PDF error: Non conformant codestream TPsot==TNsot.<0a>
#> done!
#> [1] "K190072_1.png"
Created on 2021-05-06 by the reprex package (v1.0.0)
The K190072_1.png
I finally get is only the image of the portfolio front page.
I am interessted in the document K190072.510kSummary.Final_Sent001.pdf
of this PDF portfolio
I found a way for Python (Reading a PDF Portfolio in Python?) but I would really like to do that in R.
Thank you for your help.
There seems to be an issue with
pdf_convert
handling one-page raw pdf data (it wants to usebasename(pdf)
under these conditions), so I have edited that function so that it also works with the second attached pdf file.If you only need the first file then you could run this with the original
pdf_convert
function, but it will give an error with the second file.If you are interested in rendering raster graphics from the attached files this worked for me:
Created on 2021-05-05 by the reprex package (v2.0.0)