Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Im downloading a pdf file from dropbox that I've previously saved to dropbox, created progamatically using HTML Markup. (which is working fine). But I then want to convert the pdf file to a human readable String so that I can gather specific info from that string. heres what i've been trying but its not giving me a human readable string.
/** Download pdf file from dropbox **/ // Verify user is logged into Dropbox if let dropboxClient = DropboxClientsManager.authorizedClient { // Download File from Dropbox let filename = ((cell?.textLabel?.text)! + ".pdf").lowercased() print(filename) dropboxClient.files.download(path: "/\(filename)").response { response, error in if let response = response { let responseMetadata = response.0 print("dropbox responseMetadata: \(responseMetadata)") let fileContents = response.1 as NSData print("dropbox fileContents: \(fileContents.description)") let encodedFile = String(data: fileContents as Data, encoding: String.Encoding.ascii) print("ACTUAL FILE: \(encodedFile?)") } else if let error = error { print("dropbox error: \(error)") } } }
I believe Im having trouble using the proper String.encoding, but i've tried most of them and nothing seems to work. Any help is much appreciated. Thanks
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!