开发者

Saving/showing PDF in the app

I have a URL which returns a PDF document. Typically on the web browser this would open a dialog box asking me to either open or save the PDF document. Any ideas how to work this out on the native app? Or is a change needed at the server end whereby it already has the URL to display the PDF instead of open/save? I need to display the PDF on the native app. But how do I go about the first step of the URL asking me to open/save?

Any broad ideas/high level outline of the workflow in a native app w.r.t the above use case would be greatly app开发者_开发技巧reciated.

Thanks!

EDIT: I guess the question wasn't clear enough. I am aware of how to render a PDF from the app directory or straight from a URL. The problem is the URL in this case gives out a open/save dialog box on the web browser. How do I handle that and choose to open/save it on a webview or the app directory? Or is that a use case not possible on iOS and hence is a change needed to my server side which generates the PDF and shows it directly instead of asking the user to open/save?


EDIT

Re the URL

In your plist file you can specify which URLs you wish your app to respond to

Saving/showing PDF in the app

Then in your appDelegate you need to implement a method to do something with the URL.

Something llike

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    if ([[url scheme] isEqualToString:@"specialwebsite"]) 
    {

OLD MISGUIDED ANSWER

This answer is pretty close to your requirements


Ended up using a UIWebView to load the PDF request with scalesPageToFit set as YES. Worked.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜