Git Product home page Git Product logo

m13pdfkit's Introduction

M13PDFKit

M13PDFKit is an iBooks like PDF viewer that can be embedded in iOS applications. M13PDFKit is based off of vfr/Reader. The backend uses the same classes that Reader uses, the front end has been recreated to match iOS 7's design, and use more up to date features, like UICollectionViews.

Screenshots:

  • Main view, with toolbars showing.

  • Main view without toolbars.

  • Main view, bookmarked page.

  • Thumb list, all pages.

  • Thumb list, bookmarked pages.

Installation

Podfile

source 'https://github.com/CocoaPods/Specs.git'

pod 'M13PDFKit', '1.0.2'

Usage

Prerequisite: In the storyboard, the ViewController that is intended to display the PDF file needs to be in a UINavigationController stack and its corresponding class needs to be PDFKBasicPDFViewer

Next, in the prepareSegue method of your ViewController which segues to your PDF View Controller you will then need to add the following lines:

Objective-C

//Create the document for the viewer when the segue is performed.
PDFKBasicPDFViewer *viewer = (PDFKBasicPDFViewer *)segue.destinationViewController;

//Load the document
PDFKDocument *document = [PDFKDocument documentWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Your PDF document actual location" ofType:@"pdf"] password:nil];
[viewer loadDocument:document];

Swift

//Create the document for the viewer when the segue is performed.
var viewer: PDFKBasicPDFViewer = segue.destinationViewController as PDFKBasicPDFViewer

//Load the document (pdfUrl represents the path on the phone of the pdf document you wish to load)
var document: PDFKDocument = PDFKDocument(contentsOfFile: pdfUrl!, password: nil)
viewer.loadDocument(document)

In any case, you can see an example here in the SamplesTableViewController (Obj-C only)

Issues:

There are two issues I am unable to resolve with the framework, and would like help solving.

  1. The viewer has trouble handling rotation. Upon rotation the page that is currently displayed on screen does not resize to the proper size. Once you switch pages though, everything is fine.

  2. Zooming in on pages does not allow panning. Something is overrideing the content offset while panning, and not calling "setContentOffset:{0, 0}". The pan gesture for the scroll view send the proper content offset, but the scroll view does not pan. When you pan again, the content offset starts from 0 again. It was working, but while trying to fix rotation, this broke, and I can't figure out what is wrong.

Contact Me:

If you have any questions comments or suggestions, send me a message. If you find a bug, or want to submit a pull request, let me know.

License:

MIT License

Copyright (c) 2014 Brandon McQuilkin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

m13pdfkit's People

Contributors

alua-kinzhebayeva avatar martinjo avatar marxon13 avatar ninjakittenproductions avatar simalexan avatar skyylex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.