Updating

This PlugPDF SDK iOS Developer Guide is temporarily unavailable while we are updating contents.

Please check back shortly!

PlugPDF SDK iOS Developer Guide

GUIDE

PlugPDF VIEWER

  • How can I hide top bar and bottom bar?
  • How can I hide Page number indicator on PlugPDF Viewer?
  • How can I change Page number indicator position?
  • How can I detect that page was changed?
  • How can I get page slider value?
  • How to change page Preview size.
  • How can I go to the recent page when I close the PlugPDF Viewer?
  • How can I set Document title on PlugPDF Viewer?

ANNOTATION

  • How to get annotations information?
  • How to catch an annotation is added or removed?
  • Save and Remove annotations
  • Flatten annotations
  • Circle annotation
  • Square annotation
  • TextMarkup annotations ( Highlight, Underline, Strike Out)
  • Ink annotation
  • Note annotation
  • Eraser tool

FORM

TOOLBAR

DIGITAL SIGNATURE

An iOS PDF Viewer library into your app, in 3 steps! Simple! Quick!


1. Add the PlugPDF SDK for iOS  ( iOS PDF Reader library)


Add both PlugPDF.framework and PlugPDF.bundle to your project.

Add these two dynamic libraries: libstdc++.dylib and libz.dylib, as well as the framework AVFoundation.framework to the Link Binary With Libraries build phase.

Finally, add libc++.dylib to Link Binary With Libraries in order to build on the Simulator Target.

Please read iOS Developer’s Guide ( Objectvie -C ) and iOS Developer’s Guide ( Swift ) for further information.

2. Initialize the PDF library ( iOS PDF Viewer )


In Objective-C

If iOS Deployment Target is set to a version earlier than 6.1, the Type of AppDelegate.m must be changed to Objective-C++ Source.

#import "PlugPDF/PlugPDF.h"
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    @try {
        PlugPDFInit("79F53DB9HHF9GH88EDB5297FH28FC6488AECC4EF496FB95A96CHFBF5");
    }
    @catch (NSException *exception) {
        NSLog(@"Exception %@", exception.description);
    }
    return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    PlugPDFUninit();
}

In Swift

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    let s = "79F53DB9HHF9GH88EDB5297FH28FC6488AECC4EF496FB95A96CHFBF5";
    let cs = (s as NSString).UTF8String;
    let buffer = UnsafeMutablePointer(cs);

    sample.try({ () -> Void in
        PlugPDFInit(buffer);
        }, catch: {(exception) -> Void in
            println(exception);
    });

    var vc:ViewController = ViewController();
    var navigationController:UINavigationController = UINavigationController(rootViewController: vc);
    self.window?.rootViewController = navigationController;

    return true
}

3. Instantiate the iOS PDF Viewer


In Objective-C

- (void)openPlugPDF: (id)sender {
    NSString *path = [[NSBundle mainBundle] pathForResource: @"Gone_With_the_Wind" ofType: @"pdf"];
    NSString *password = @"";
    NSString *title = [[path lastPathComponent] stringByDeletingPathExtension];
    PlugPDFDocumentViewController *viewController = nil;
    @try {
        viewController = [PlugPDFDocumentViewController initWithPath: path
                                                            password: password
                                                               title: title];
    }
    @catch (NSException *exception) {
        NSLog(@"Exception %@ %@", exception.name, exception.description);
    }
    if (viewController) {
        [self.navigationController pushViewController: viewController
                                             animated: YES];
        if ([[UIDevice currentDevice].systemVersion hasPrefix:@"7"] ||
            [[UIDevice currentDevice].systemVersion hasPrefix:@"8"]) {
            [viewController setAutomaticallyAdjustsScrollViewInsets: NO];
        }
    }
}

In Swift

func openPlugPDF(sender: UIButton!) {
    let path = NSBundle.mainBundle().pathForResource("PlugPDF SDK Test Page", ofType: "pdf");
    let password = "";
    let title = path?.lastPathComponent.stringByDeletingPathExtension;

    let vc = PlugPDFDocumentViewController.initWithPath(path, password: password, title: title);

    if((vc) != nil) {
        self.navigationController?.pushViewController(vc, animated: true);

        if(UIDevice.currentDevice().systemVersion.hasPrefix("7") ||
            UIDevice.currentDevice().systemVersion.hasPrefix("8")) {
                vc.automaticallyAdjustsScrollViewInsets = false;
        }
    }        
}