开发者

Issues in save pdf file on iPad

开发者 https://www.devze.com 2023-01-17 07:11 出处:网络
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 usingthe following path for save pdf file on iPad:-

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 ?

开发者_C百科 Is file path wrong? then suggest me the file path for saving the pdf file ?

Thanks in Advance


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消