I am using R, version 3.3.2.. I have downloaded base64 file from API. Here is output (base64) file (all file have 27 pages so I put just liitle part of it):
list(structure(list("584959666b2e5f32bc43fad1", "584959666b2e5f32bc43fad1.pdf",
91572L, "JVBERi0xLjQKJdP0zOEKMSAwIG9iago8PAovUGFnZXMgMiAwIFIKL05hbWVzIDI2IDAgUgovUGFnZUxheW91dC9PbmVDb2x1bW4KL01ldGFkYXRhIDI4IDAgUgovVHlwZS9DYXRhbG9nCi9PdXRwdXRJbnRlbnRzWwo8PAovT3V0cHV0Q29uZGl0aW9uKCkKL091dHB1dENvbmRpdGlvbklkZW50aWZpZXIoQ3VzdG9tKQovUmVnaXN0cnlOYW1lKCkKL0luZm8oc1JHQiBJRUM2MTk2Ni0yLjEpCi9UeXBlL091dHB1dEludGVudAovRGVzdE91dHB1dFByb2ZpbGUgMyAwIFIKL1MvR1RTX1BERkExCj4+Cl0KL1ZpZXdlclByZWZlcmVuY2VzIDQgMCBSCi9QYWdlTW9kZS9Vc2VOb25lCj4+CmVuZG9iagoyIDAgb2JqCjw8Ci9Db3VudCAxCi9LaWRzWzUgMCBSXQovVHlwZS9QYWdlcwo+PgplbmRvYmoKMyAwIG9iago8PAovTiAzCi9GaWx0ZXIvRmxhdGVEZWNvZGUKL0xlbmd0aCAyNTM3Cj4+CnN0cmVhbQp4Xp2WZ1RT2RbHz703vVCSEDqE3qS3ANJ7k15FKUmAUAIGAojYEFGBEUVEmg0ZFHDA0aHIWBHFwoCgYHeCDCLqOFgQFctL5K3RN++9WTPz/3DPb+1y7zl777PWBYDk5cflZcBSAKTzsvnBni6MyKhoBnYQwAAPMMAUgHhWVqZ/iEcoEMnb3ZWRJQoC/6HXYwASr9cMvQIZDPD3JM3K5GcDAAWK2JzNyWKJuEjEabnZmWL7jIhpCalihlFi5os2KGI5MSct8KLPMQvsJGZ2Oo8tYvGeM9npbDH3iXhzjoAjYsRPxMU5XE6uiK+LWDNNkM4V8RtxbjonPgsAFElsz+awkkVsImISPzTYVcSLAcCR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RlTWVudWJhciBmYWxzZQo+PgplbmRvYmoKNSAwIG9iago8PAovQ29udGVudHNbOCAwIFIgOSAwIFJdCi9SZXNvdXJjZXMKPDwKL1Byb2NTZXRbL1BERi9UZXh0L0ltYWdlQ10KL1hPYmplY3QKPDwKL0hpUVBkZl9tZWlnbmhvZ21la2FrbWtkYmRwbGVnZnBrZ2NrbmRpbiA2IDAgUgovSGlRUGRmX2Frb25haGxjcGVkaGttcHBwZGJwcGZoZ2hrY2ZraWdmIDcgMCBSCj4+Cj4+Ci9NZWR ",
"application/pdf"), .Dim = c(1L, 5L), .Dimnames = list(NULL,
c("dokumentId", "filename", "lenght", "content", "contentType"
))))
I would like to convert this file to text or pdf file, and then parse it. I have tried to use two packages but without success: base64enc
and base64
.
For example I have tried:
text <- document[[1]][[4]]
plain_text <- base64enc::base64decode(text)
plain_text <- rawToChar(plain_text)
and
text <- document[[1]][[4]]
test_file <- write.csv2(text, "E:/somepath/test_file.csv")
tmp <- tempfile()
base64::decode(input = test_file, output = tmp)
, but without success. Could you please help me with this issue?