Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Now iBooks supports PDF. My app has access to many PDF files. Is it possible to send PDFs to iBooks (or other PDF readers like GoodReader and iAnnotate PDF) from my app?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
276 views
Welcome To Ask or Share your Answers For Others

1 Answer

//get path to file you want to open 

NSString *fileToOpen = [[NSBundle mainBundle] pathForResource:@"readme" ofType:@"pdf"];

//create NSURL to that path

NSURL *url = [NSURL fileURLWithPath:fileToOpen];

//use the UIDocInteractionController API to get list of devices that support the file type

docController = [UIDocumentInteractionController interactionControllerWithURL:url];

[docController retain];

//present a drop down list of the apps that support the file type, click an item in the list will open that app while passing in the file.

 BOOL isValid = [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...