Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
whizpool t.
10 years agoNew member | Level 1
how to get all files in pdf format can dropbox convert before i download it through the API
I have doc file on my dropbox when i access these files from my app i want them to be in pdf techincally i want them to be downloaded in pdf
Greg-DB
Dropbox Community Moderator
10 years agoFor example, I'm not an Objective-C expert, but something like this (modified from your previous code sample):
MPOAuthCredentialConcreteStore *creds = [[DBSession sharedSession] credentialStoreForUserId:UID];
NSString *authorization = [NSString stringWithFormat:@"OAuth oauth_version=\"1.0\", oauth_signature_method=\"PLAINTEXT\", oauth_consumer_key=\"%@\", oauth_token=\"%@\", oauth_signature=\"%@&%@\", appKey, creds.accessToken, appSecret, creds.accessTokenSecret];
NSString *filePath = @"/Testing/Documents/test.docx";
NSURL *url = [NSURL URLWithString:[
[NSString stringWithFormat:@"https://content.dropboxapi.com/1/previews/auto/%@", filePath] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding
]
];
NSMutableURLRequest *request =
[NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:10
];
[request setValue:authorization forHTTPHeaderField:@"Authorization"];
[request setHTTPMethod: @"GET"];
NSError *requestError = nil;
NSURLResponse *urlResponse = nil;
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&requestError];
NSString *fileName = @"test_205881743.pdf";
NSString *localDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
NSString *localFilePath = [localDir stringByAppendingPathComponent:fileName];
[response writeToFile:localFilePath atomically:YES];
NSLog(@"%@", localFilePath);
(That doesn't have the error handling implemented though.)
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!