Skip to content

pawanline/PKDocumentViewer

Repository files navigation

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, bestappledeveloper@gmail.com,https://pawankumar.cf/

License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors