PKDocumentViewer 0.1.3

PKDocumentViewer 0.1.3

Maintained by Pawan Kumar.



  • By
  • Pawan Kumar iOS Developer

PKDocumentViewer

Version License Platform codebeat badge

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 13.0+
  • Xcode 11.0+

Installation

PKDocumentViewer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'PKDocumentViewer'

Code Example for setup

//implement UIDocumentInteractionControllerDelegate
class ViewController: UIViewController,UIDocumentInteractionControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Setup delegates
          PKDocumentViewer.shared.setUpDelegates(self)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    @IBAction func viewPDFButtonTapped(_ sender: Any) {
        // Call to view pdf
               PKDocumentViewer.shared.viewPdf(urlPath: "http://www.pdf995.com/samples/pdf.pdf", screenTitle: "Tesing Document")
    }
    
    // when a document interaction controller needs a view controller for presenting a document preview.
      
    // use this fuction for preview
       func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
          return self.navigationController ?? UIViewController()
      }
}

Usage

preview

Author

Pawan Kumar iOS Developer, [email protected],https://pawankumar.cf/

License

PKDocumentViewer is available under the MIT license. See the LICENSE file for more info.