将PDF发送到iBooks

时间:2010-06-23 01:33:19

标签: iphone pdf

现在iBooks支持PDF。我的应用可以访问许多PDF文件。是否可以从我的应用程序向iBooks(或其他PDF阅读器,如GoodReader和iAnnotate PDF)发送PDF?

3 个答案:

答案 0 :(得分:11)

//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];

答案 1 :(得分:2)

要回答我自己的问题 - 是的,您可以使用以下方法向支持自定义URL方案的应用发送PDF:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

GoodReader的URL方案是:

url=@"ghttp://www.mysite.com/myfile.pdf";

iAnnotate PDF是:

url=@"pdfs://www.mysite.com/myfile.pdf";

有没有人知道iBooks的自定义URL方案?

答案 2 :(得分:0)

使用此链接查找网址方案http://schemes.zwapp.com/

并使用[[UIApplication sharedApplication] openURL:url];

在该应用程序中启动。

感谢