Mike Schmidt Mike Schmidt - 4 months ago 71
iOS Question

IOS PDF Viewer?

I am looking for an IOS PDF viewer for a Swift iPad application I am working on. Using UI Web View does not really have enough functionality that I need for the app to work smoothly. Here is what I need:


  • Search in the Document (not necessary)

  • Jump to a page

  • Download to local storage

  • Update to newest version when connected to the internet



I understand that not all of these have to do with the actual PDF viewer, but I listed them because they will eventually need to work with the PDF viewer. I am very reluctant to try and use one of the many PDF viewers that are out there, because I am looking for something that looks professional and is pretty simple.

Should I use a PDF viewer kit or try to customize the UI Web View a little bit? I am not sure what to do in this situation. Help is appreciated!

Answer

I suggest to use M13PDFKit. Its quite easy and have more functionalities such as thumbnails view and swipe to right.

Your code would be simple as

// get main viewer controller
let viewerController = self.storyboard?.instantiateViewControllerWithIdentifier("PDFChildViewController") as! PDFChildViewController

// pass the file path / string url
let document: PDFKDocument = PDFKDocument(contentsOfFile: filePath , password: nil)
viewerController.loadDocument(document)

// present
self.presentViewController(viewerController, animated: true, completion: { 
    // do something when start present the pdf
})
Comments