开发者

iphone : how can we store pdf file in local and read it?

开发者 https://www.devze.com 2023-02-08 03:09 出处:网络
i want to store pdf file in开发者_C百科 local and read it . i want to read this pdf same as iphone read data in mkmapview.

i want to store pdf file in开发者_C百科 local and read it . i want to read this pdf same as iphone read data in mkmapview.

means i want to create same as pdf(Acrobat) reader.how can i do this?


you can store the pdf in the application bundle and display it using a uiwebview:

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];

NSString *path = [[NSBundle mainBundle] pathForResource:@"document" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];

[self.view addSubview:webView];
[webView release];

to load it from an url you can do something like this:

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];

NSURL *targetURL = [NSURL URLWithString:@"http://www.mywebsite.com/myPdfFile.pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];

[self.view addSubview:webView];
[webView release];

you can also download your pdf into the documentDirectory during runtime and load it from there.


i think you need this

http://github.com/akisute/iPhonePDF

from here you can find code (api) by that you can genrate pdf in iphone .

and also can do edit it.

Let me know this is what you need ?


You can open the PDF with iBooks or any other app that can read PDF files to store it locally on the Phone.

0

精彩评论

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