views:

41

answers:

0

I wish to view documents (pdfs) in a UIWebView and allow the user the option of saving the file for offline viewing.

I know how to load from the web using;

[webView loadRequest: [NSURLRequest requestWithURL:[NSURL URLWithString:doc]]];

and I know how to load a file in my bundle;

NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@"fileName" ofType:@"pdf"];
NSURL *url = [NSURL URLWithString:pdfPath];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[webView loadRequest:urlRequest];

I now wish to combine the 2, loading the file and displaying but then also having a save button without having to download all over again.

Is there a way to move a document from the sandbox to the device's Document directory?
Or do I download as a file each time and then delete on viewDidUnload unless the save button was touched?