本文介绍了如何打开Acrobat Reader阅读pdf文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多.pdf格式的文件。我在集合视图中显示文件的名称。现在在didSelectItemAtIndex方法中,我想打开Acrobat Reader来打开pdf文件。我该如何实现? Acrobat Reader也有URL方案,以便我可以检测该应用程序是否在手机上?

I have many files in .pdf format. I'm display the names of the files in a collection view. Now in the didSelectItemAtIndex method, I want to open Acrobat Reader to open the pdf files. How do I implement this ? Also does Acrobat Reader have an URL Scheme so that I can detect whether the app is on the phone ?

推荐答案

这是应用程序Adobe Reader的架构:

This is the app schema for Adobe reader :

com.adobe.Adobe-Reader

在Swift中,您可以执行以下操作:

In Swift, you can do the following :

           var docController: UIDocumentInteractionController?
    if let path = Bundle.main.path(forResource: "PDF-NAME", ofType: "pdf") {
            let targetURL = NSURL.fileURL(withPath: path)
            docController = UIDocumentInteractionController(url: targetURL)
            let url = NSURL(string:"com.adobe.Adobe-Reader:");
            if UIApplication.shared.canOpenURL(url! as URL) {
                docController!.presentOpenInMenu(from: .zero, in: self.view, animated: true)
                print("Adobe-Reader")
            }else{
                print("Adobe-Reader is not installed")
            }
    }

这篇关于如何打开Acrobat Reader阅读pdf文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 02:42