简体   繁体   English

将PDF发送到iBooks

[英]Send PDF to iBooks

Now iBooks supports PDF. 现在iBooks支持PDF。 My app has access to many PDF files. 我的应用可以访问许多PDF文件。 Is it possible to send PDFs to iBooks (or other PDF readers like GoodReader and iAnnotate PDF) from my app? 是否可以从我的应用程序向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];

To answer my own question - yes, you can send a PDF to apps supporting custom URL scheme using this: 要回答我自己的问题 - 是的,您可以使用以下方法向支持自定义URL方案的应用发送PDF:

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

URL scheme for GoodReader is: GoodReader的URL方案是:

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

iAnnotate PDF is: iAnnotate PDF是:

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

Does anyone know the custom URL scheme for iBooks? 有谁知道iBooks的自定义URL方案?

Use this link to find the url schemes http://schemes.zwapp.com/ 使用此链接查找网址方案http://schemes.zwapp.com/

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

to launch in that application. 在该应用程序中启动。

thanks 谢谢

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

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