Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS PDF Viewer? [closed]

Tags:

ios

pdf

swift

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!

like image 331
Mike Schmidt Avatar asked Jul 18 '16 23:07

Mike Schmidt


People also ask

Why can I preview a PDF but not open it?

Here are some of the most common culprits to consider: Your laptop doesn't have a PDF reader installed. Your PDF reader or preferred program is out of date and needs an update. Your PDF application is potentially damaged or needs to be rebooted.

Why is my PDF not opening automatically?

Once in Adobe Reader, click the Edit menu in the menu bar, and then clickPreferences... The Preferences window will open. In the Categories section, click on Internet. Make sure the first check box, Display PDF in browser, is checked.


2 Answers

I think your best bet is Quick Look Framework from Apple. It is extremely smooth and easy to use. You can have a list of many documents and switch between them while previewing document. Moreover, it is the viewer used everywhere in iOS, so users are already familiar with it and it comes with all basic functionalities (zoom, select, copy/paste, ...).

A good tutorial is Using Quick Look Framework for Previewing Documents with Swift.

like image 191
AnthoPak Avatar answered Oct 02 '22 19:10

AnthoPak


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(contentsOfFile: filePath , password: nil)
viewerController.loadDocument(document)

// present
self.presentViewController(viewerController, animated: true, completion: { 
    // do something when start present the pdf
})
like image 23
h8d8now Avatar answered Oct 02 '22 21:10

h8d8now