Reputation: 3562
I have a pdf file in my iPad application. I want to save that pdf file on iPad so that I can read it out of my application. I am using the following path for save pdf file on iPad:-
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fileBPath = [documentsDirectory stringByAppendingPathComponent:@"tmp.pdf"];
But I am not able to find this pdf file on my iPad.
Can anyone suggest me how can I find it ?
Is file path wrong? then suggest me the file path for saving the pdf file ?
Thanks in Advance
Upvotes: 0
Views: 891
Reputation: 2975
1) See this SO question/answer regarding creation of a pdf from a UIView
2) If you already have the pdf file as an NSData object, you can save that to a file in your documents directory using
[NSData writeToFile:fileBPath atomically:YES];
3) On the other hand, if the PDF file is part of your application bundle (ie included with the app at compile time) it won't be in the documents directory.
Take a look at the documentation for [NSBundle mainBundle] -- that is where your PDF will be.
Upvotes: 2