GithubHelp home page GithubHelp logo

ios-pdf-reader's People

Contributors

abhikpo avatar alua-kinzhebayeva avatar benbahrenburg avatar bilallourd avatar bitdeli-chef avatar jobinsjohn avatar jwelton avatar le4ker avatar marcofilosi avatar ranunez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-pdf-reader's Issues

POD Install error

when i install PDFReader pod i got error
"[!] Unable to find a specification for PDFReader
"

NSInvalidArgumentException: attempt to scroll to invalid index path: <NSIndexPath: 0x174232ce0> {length = 2, path = 0 - 4}

So, I've got a single crash report from a live app and the reason given was:

NSInvalidArgumentException: attempt to scroll to invalid index path: <NSIndexPath: 0x174232ce0> {length = 2, path = 0 - 4}

I'm not too worried about it, i'm just trying to figure out how it happened/how it can be prevented.
The crash appeared to have taken place in PDFThumbnailCollectionViewController :

if !collectionView.indexPathsForVisibleItems.contains(curentPageIndexPath) { collectionView.scrollToItem(at: curentPageIndexPath, at: .centeredHorizontally, animated: true) }
but you are checking if the collectionview has that indexPath and if true, you are going to it, but the crash appears to say that you tried to go to an index path the the cv did not have.

Partial stack trace

0 CoreFoundation
__exceptionPreprocess + 124
1 libobjc.A.dylib
objc_exception_throw + 52
2 CoreFoundation
+[NSException raise:format:] + 112
3 UIKit
-[UICollectionView _contentOffsetForScrollingToItemAtIndexPath:atScrollPosition:] + 220
4 UIKit
-[UICollectionView scrollToItemAtIndexPath:atScrollPosition:animated:] + 68
5 PDFReaderPDFThumbnailCollectionViewController.swift:30
currentPageIndex.didset
6 PDFReaderPDFViewController.swift
scrollViewDidScroll
7 PDFReaderPDFViewController.swift
scrollViewDidScroll

JPEGDecompressSurface : Picture decode failed: e00002c2

Hi,

I am developing an iPad app for storing and reading music sheets pdfs. Most of the pdfs i load into the app using your PDFReader (which is great btw) are scans. So basically a PDF file with a big picture on it.

With some pdf files i face the following issue:
JPEGDecompressSurface : Picture decode failed: e00002c2

After the message is shown in the xcode output it just shows a white blank pdf site with no content.
It's not crashing or something it's just showing a white page.

Simply The Best.pdf

Attached you can find the pdf file so that you can easily reproduce the problem.

Thanks and keep up your good work!

Br, Daniel

Fraction completed showing 0

On downloading a pdf from remote url,download progress fraction completed is always showing 0.How can this be solved

Display progress hud

is it possible to use progress hud while using remote url. Until the download is finished

Override actionButton Button

Hello,

Thanks for all of the work on this great library. I'm currently using this on one of my projects an need to override the actionButton button.

In the latest build the logic has been updated alittle on this. Before I sent a PR wanted to check what approach you might this is best.

The easiest is to make the actionButton public. This would allow the setting application to override.

fileprivate var actionButton: UIBarButtonItem?

I noticed you updated the create logic to use a new method. Pretty neat. Below is my take on how the calling application could pass in the actionButton as part of this approach.

What which strategy (if any) do you think falls most inline with your thinking?

extension PDFViewController {
    /// Initializes a new `PDFViewController`
    ///
    /// - parameter document:          PDF document to be displayed
    /// - parameter title:             title that displays on the navigation bar on the PDFViewController; if nil, uses document's filename
    /// - parameter actionButtonImage: image of the action button; if nil, uses the default action system item image
    /// - parameter actionStyle:       sytle of the action button
    ///
    /// - returns: a `PDFViewController`
    public class func createNew(with document: PDFDocument, title: String? = nil, actionButtonImage: UIImage? = nil, actionStyle: ActionStyle = .print) -> PDFViewController {
        let storyboard = UIStoryboard(name: "PDFReader", bundle: Bundle(for: PDFViewController.self))
        let controller = storyboard.instantiateInitialViewController() as! PDFViewController

        if let actionButtonImage = actionButtonImage {
            let actionButton = UIBarButtonItem(image: actionButtonImage, style: .plain, target: controller, action: #selector(actionButtonPressed))
            return PDFViewController.createNew(with: document, title: title, actionButton: actionButton,actionStyle: actionStyle)
        }

        let actionButton = UIBarButtonItem(barButtonSystemItem: .action, target: controller, action: #selector(actionButtonPressed))

        return PDFViewController.createNew(with: document, title: title, actionButton: actionButton,actionStyle: actionStyle)
    }

    /// Initializes a new `PDFViewController`
    ///
    /// - parameter document:          PDF document to be displayed
    /// - parameter title:             title that displays on the navigation bar on the PDFViewController; if nil, uses document's filename
    /// - parameter actionButton:      UIBarButtonItem used to override the default action button
    /// - parameter actionStyle:       sytle of the action button
    ///
    /// - returns: a `PDFViewController`
    public class func createNew(with document: PDFDocument, title: String? = nil, actionButton: UIBarButtonItem, actionStyle: ActionStyle = .print) -> PDFViewController {
        let storyboard = UIStoryboard(name: "PDFReader", bundle: Bundle(for: PDFViewController.self))
        let controller = storyboard.instantiateInitialViewController() as! PDFViewController
        controller.document = document
        controller.actionStyle = actionStyle

        if let title = title {
            controller.title = title
        } else {
            controller.title = document.fileName
        }

        controller.actionButton = actionButton

        return controller
    }
}

Use of unresolved identifier 'PDFDocument'

Admittedly new to Xcode and Swift 3 and looking for a PDF solution that works, I found this framework.

However, following the instructions (and finally figuring out that the code given should be in the viewDidLoad(), I still get the error "Use of unresolved identifier 'PDFDocument'"

` override func viewDidLoad() {
super.viewDidLoad()

let remotePDFDocumentURLPath = "http://devstreaming.apple.com/videos/wwdc/2016/201h1g4asm31ti2l9n1/201/201_internationalization_best_practices.pdf"
let remotePDFDocumentURL = URL(string: remotePDFDocumentURLPath)!
let document = PDFDocument(url: remotePDFDocumentURLPath)!     <<<=== get error here
let readerController = DocViewController.createNew(with: document)
navigationController?.pushViewController(readerController, animated: true)
}

`

This seems a basic install problem, though the instructions are not clear.

I looked through the issues and found one that said to link the framework in Embedded Binaries - seemed to be logical it would relate, but that didn't help.

I've tried several ways to read PDFs and nothing has worked, so I really do hope this one will do what it says - it certainly looks good.

PDFReader 2.5.1 is not recognized as a Swift4 project

PDFReader 2.5.1 has been written in Swift4 but CocoaPods 1.3.1 install it as a Swift 3.2 project

Version Info

  • PDFReader version: 2.5.1
  • CocoaPods version: 1.3.1
  • XCode version: 9.1 (9B55)

Expected Behavior

Execute pod install and then compile project on XCode as a Swift 4 project.

Actual Behavior

20 Swift Compiler Errors. Error messages are: xxx is inaccessible due to 'private' protection level

Steps to Reproduce

  1. Install XCode 9.1 and CocoaPods 1.3.1
  2. Run a project that depends on PDFReader 2.5.1
  3. XCode cannot compile project because of PDFReader errors

Names conflcts in iOS11

PDFDocument is now an official iOS 11 class, so using this project for conditional code to display in iOS<11 pdf documents isn't working, any clue to use both? (ps: using into an obj-c project)

CPU overloading

​Thank you for sharing your library and hardworking.

We have spotted an issue with iOS 8 & 9 which cause CPU overloading and crash the application. However, it works well with iOS 10.

We just want to let you know about this issue and hope that it will be useful for the library improvement.

Thanks.

Main Thread Checker: UI API called on a background thread: -[UIView bounds]

Xcode 9 adds a new main thread checker. I was running our app through the main thread checker to see where we may be accessing properties or invoking methods from background threads and discovered that bounds in TiledView.swift line 62 is not called from main thread.

Version Info

  • PDFReader version: 2.4.0
  • iOS version: 11.0

Expected Behavior

Access -[UIView bounds] from main thread

Actual Behavior

Access -[UIView bounds] from com.apple.root.default-qos dispatch queue.

Steps to Reproduce

  1. Install XCode 9
  2. Run a project that instantiates and push a PDFReaderViewController
  3. Wait until view controller has been initialized. In Logs you could find message error from Main Thread Checker

Logs

Main Thread Checker: UI API called on a background thread: -[UIView bounds]
PID: 5094, TID: 1329417, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 21
Backtrace:
4   PDFReader                           0x0000000103564bf3 _T09PDFReader9TiledViewC4drawySo7CALayerC_So9CGContextC2intF + 291
5   PDFReader                           0x000000010356543d _T09PDFReader9TiledViewC4drawySo7CALayerC_So9CGContextC2intFTo + 77
6   QuartzCore                          0x000000010ea5c0f8 -[CALayer drawInContext:] + 267
7   QuartzCore                          0x000000010e9a8476 _ZL18tiled_layer_renderP16_CAImageProviderjjjjPv + 1817
8   QuartzCore                          0x000000010ea325ae _ZL21CAImageProviderThreadPjb + 789
9   libdispatch.dylib                   0x0000000109dcf43c _dispatch_client_callout + 8
10  libdispatch.dylib                   0x0000000109dd4352 _dispatch_queue_override_invoke + 1458
11  libdispatch.dylib                   0x0000000109ddb1f9 _dispatch_root_queue_drain + 772
12  libdispatch.dylib                   0x0000000109ddae97 _dispatch_worker_thread3 + 132
13  libsystem_pthread.dylib             0x000000010a2925a2 _pthread_wqthread + 1299
14  libsystem_pthread.dylib             0x000000010a29207d start_wqthread + 13

Flicker in UIPageViewController's views

Hi,

I've integrated the PDFPageView into a UIPageViewController's view so that I can use a page controller instead of a collection view.

However, the screen flickers if it is being initially rendered. This behaviour is not present in a collection view. Scroll mode is worse than page curl.

Do I have to set any properties on the view, which hosts the PDFPageView? I don't use Storyboards.

Unable to convert Ruby value `"bplist00

FYI: I get the following error when running pod install.

Unable to convert Ruby value "bplist00\xD1\u0001\u0002_\u0010\u000FWebMainResource\xD5\u0003\u0004\u0005\u0006\a\b\t\n\v\f^WebResourceURL_\u0010\u000FWebResourceData_\u0010\u0013WebResourceMIMEType_\u0010\eWebResourceTextEncodingName_\u0010\u0014WebResourceFrameName_\u0010Qhttps://raw.githubusercontent.com/Alua-Kinzhebayeva/iOS-PDF-Reader/master/LICENSEO\u0011\u0004\xC4<html><head><style type=\"text/css\"></style></head><body><pre style=\"word-wrap: break-word; white-space: pre-wrap;\">The MIT License (MIT)\n\nCopyright (c) 2015 Alua-Kinzhebayeva\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</pre></body></html>Ztext/plainUUTF-8P\u0000\b\u0000\v\u0000\u001D\u0000(\u00007\u0000I\u0000_\u0000}\u0000\x94\u0000\xE8\u0005\xB0\u0005\xBB\u0005\xC1\u0000\u0000\u0000\u0000\u0000\u0000\u0002\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\r\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0005\xC2"' into a CFTypeRef.

Stack

   CocoaPods : 1.0.1
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
    RubyGems : 2.0.14.1
        Host : Mac OS X 10.11.4 (15E65)
       Xcode : 7.3 (7D175)
         Git : git version 2.6.4 (Apple Git-63)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 6c3573b3ac5426c60881e364c42c80a6b37fe2ac

Plugins

cocoapods-deintegrate : 1.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.1.0

Podfile

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'IZLA_QR' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for IZLA_QR
pod 'PDFReader', '1.0.0'

  target 'IZLA_QRTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Error

PDF doesn't appear in the right direction

PDF is not flipped to the right direction.

The below code is not working.
// Flip the context so that the PDF page is rendered right side up.
con.translateBy(x: 0, y: bounds.size.height)
con.scaleBy(x: 1, y: -1)

I think you need to add "concatenate" - context.concatenate(_ transform: CGAffineTransform)

Double Tap opens/closes NavigationBar

In the current (podfile) version a double tap also opens/closes the NavigationBar. To ignore the single tap if there is a double tap I altered your code the following way:

Inside PDFPageView.swift:

internal final class PDFPageView: UIScrollView {

    ...

    init(frame: CGRect, document: PDFDocument, pageNumber: Int, pageViewDelegate: PDFPageViewDelegate?) {

        ...
        
        let doubleTapOne = UITapGestureRecognizer(target: self, action:#selector(handleDoubleTap))
        doubleTapOne.numberOfTapsRequired = 2
        doubleTapOne.cancelsTouchesInView = false
        addGestureRecognizer(doubleTapOne)
        
        let singleTapOne = UITapGestureRecognizer(target: self, action:#selector(handleSingleTap))
        singleTapOne.numberOfTapsRequired = 1
        singleTapOne.cancelsTouchesInView = false
        addGestureRecognizer(singleTapOne)
        
        singleTapOne.require(toFail: doubleTapOne) // New Line
        
        ...
    }    
    ...
}

feel free to adopt this behaviour ;)

Warning in TiledView.swift on version 2.5.1

Merging #67 issue caused just an introduction of a warning, because now bounds is not used anymore inside override func draw(_ layer: CALayer, in con: CGContext) method.
Bug #64 was already fixed by using layer.bounds instead of bounds

Issue running on iOS 9.3.5

Can't touch on screen if pdf file contain more than 2 images,look like userinteraction property was false

open pdf using url

i am using this pdf reader it is working fine but everytime if i want to display pdf i have to save,
is there any way to open directly with url

Demo project crashes on devices

It's not a real bug of the framework but on the demo project.
Xcode will crash with SIGABRT "Library not loaded, image not found" unless you add PDFReader.framework to Target Demo> tab general> Embedded Binaries

URL Request

Hello Friend, im actually using PDFReader my question is the next, can i request PDF from url with this Framework? if it yes, how can i? Thank You so much!

How to add multiple attributes to PDFViewController

Hi,
I'm having some trouble adding multiple attributes to the controller.

let documentURL = Bundle.main.url(forResource: "Cupcakes", withExtension: "pdf")!
let document = PDFDocument(fileURL: documentURL)!
let readerController = PDFViewController.createNew(with: document, actionStyle: .activitySheet)
navigationController?.pushViewController(readerController, animated: true)

if I now want to disable the thumbnails, I add the following to the code:

let readerController = PDFViewController.createNew(with: document, actionStyle: .activitySheet, isThumbnailsEnabled: false)

but i get an error: "argument 'isThumnailsEnabled' must precede argument 'actionStyle'"

Also when I want to change the scroll direction, it says that PDFViewController has no member 'scrollDirection'

controller.scrollDirection = .vertical

Please help :)

Error on pod install

[!] Error installing PDFReader
[!] /usr/bin/git clone https://github.com/Alua-Kinzhebayeva/iOS-PDF-Reader.git /var/folders/4l/204wv16932vb0xfmrs2jn6y40000gn/T/d20170303-41724-1yxpt02 --template= --single-branch --depth 1 --branch master

When trying to run pod install, only happens in iOS-PDF-Reader

Sharing PFD file with other apps

Hello Alua,

First of all, thanks for the great work!
Your pod is happily being used in Dono for iOS, let me know if you are interested in joining the test ring 😄

Second, how about enabling to share the pdf file on other apps?
For example in the iBooks app you can either print the pdf or share it via email.

Thanks again for the effort!
:panos

edit:

I just noticed in the README

Customize the action button by replacing the UIBarButtonItem displayed with your own

So it's actually possible to inject it into the framework, good stuff! 😄

Protocol Support for PDFDocument

@ranunez after thinking about it alittle more I think there is a better approach then the one I first suggested. If a protocol is used for the PDFDocument it would allow those using the project to create their own "document" as long as they conform to the interface.

For those using the existing PDFDocument there is no change as PDFDocument inherits from the protocol. I did have to make fileURL and fileName optional as someone calling using Data or CGPDFDocument wouldn't have these.

If you are ok with a protocol approach like this let me know and I'll create documentation and examples as part of the PR process.

You can see the very minor changes needed to support this approach in the below branch
https://github.com/benbahrenburg/iOS-PDF-Reader/tree/exp2

Let me know if you'd like to discuss further.

Unable to Compile

Unable to compile Xcode 9 swift 3.2. Lot of internal error, inaccessible due private protection level.

Loading PDF from Data or CGPDFDocument

Hello,

For one of my current projects I need to be able to load pdfs from a variety of different sources. I thought maybe you would be interested in looking at if the project could benefit. Basically I added a strategy to the init of the PDFDocument that allows the strategy to create the CGPDFDocument and required fields. Since some of the options don't have associated files I had to add some optional handling for the filename and file path.

Below is the branch with the changes I've been working on. If you are interested I can work on putting together a a PR.
https://github.com/benbahrenburg/iOS-PDF-Reader/tree/journey-exp

thumbnails caching - related to #28

Now that there is a caching system for the thumbnail.
The view are loaded faster.
However it created a new issue which i just discover.

I've a table view with a list of PDFs.
When i click on one, I generate a PDFViewController and then push it on my NavigationController.
The problem is when I go back and select another PDF, the thumbnail are from the first opened PDF.

Action button not set on createNew(....

in iOS 10 when you call createNew(....

The view is loaded before the Right action button can be set to the controller, there by setting a nil right action button in viewDidLoad.

For some reason, the call controller.isThumbnailsEnabled = isThumbnailsEnabled is loading the view.

Apps cannot running when it downloaded directly

Hi, i want to try download directly this apps from github(without using CocoaPods or Carthage). When i want to build it, it successfully run but iPhone simulator does not appear. Is that anything wrong to me? can you explain how?

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.