繁体   English   中英

将PDF发送到iBooks

[英]Send PDF to iBooks

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

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

要回答我自己的问题 - 是的,您可以使用以下方法向支持自定义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方案?

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

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

在该应用程序中启动。

谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM