MobX
MobX

Reputation: 2670

PDF reader for iOS with left to right paging support

I am trying to develop an app for iOS in SWIFT ,which has a requirement to render Arabic PDF files and allow the user to read the PDF by swiping from left to right.I have tried a lot of libraries ,but didn't find a perfect way to do this.Can any please help me on this with any libraries or ideas. Thanks in advance

Upvotes: 1

Views: 1149

Answers (2)

Nitin Gohel
Nitin Gohel

Reputation: 49720

Hi i just create a Swift project using https://github.com/vfr/Reader and you need to do following steps to convert this objective library in to swift:

  • First you need to create a Bridge header file in to you swift project.
  • Then you need to add vfr required file in to you project (that will be attached in my Sample code)
  • Now you need to set import statement in to Bridge Header file

#ifndef Bridge_Header_h

#define Bridge_Header_h

#import "ReaderViewController.h"

#endif /* Bridge_Header_h */

  • Add this Bridge file in to Project->target-> build Setting -> Objective-c Bridging Header and set Bridge file.
  • Now Opne your project View Controller from that you wish to open pdf set Delegate file like:

class ViewController: UIViewController , ReaderViewControllerDelegate {

And it's View Controller ViewDidLoad code:

 override func viewDidLoad() {
        super.viewDidLoad()
        let filepath = (NSBundle.mainBundle().pathForResource("Reader", ofType:"pdf"))! as String
        
        if let document = ReaderDocument.withDocumentFilePath(filepath, password: "")
        {
            let readerViewController: ReaderViewController = ReaderViewController(readerDocument: document)
            readerViewController.delegate = self
            // Set the ReaderViewController delegate to self
            self.navigationController!.pushViewController(readerViewController, animated: true)
        }
    }

Sample Code: https://github.com/nitingohel/NGSwiftPdfReader

RealTime Output:

enter image description here

Upvotes: 1

xmhafiz
xmhafiz

Reputation: 3538

try M3PDFKIT or vfr. I use M3PDFKIT, can swipe to right and left

Upvotes: 0

Related Questions