Try the PSPDFKit Demo

You can try PSPDFKit in a few simple steps and get the library up and running in your app with little to no effort.

Note: This article is about using the PSPDFKit trial for evaluation purposes. If you don't have a trial license yet, fill out the form to get one.

Integrate the PSPDFKit Framework

The easiest way to get started is using CocoaPods. Add the following to your Podfile, and then run pod install:

Copy
1
2
3
4
5
use_frameworks!

target :YourTargetName do
  pod 'PSPDFKit', podspec: 'https://customers.pspdfkit.com/cocoapods/YOUR_COCOAPODS_KEY_GOES_HERE/latest.podspec'
end

To get the extensive sample app, download the disk image (dmg). This includes the binary SDK which can be used for manual integration.

Set the License Key

Copy
1
2
3
4
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
    PSPDFKit.setLicenseKey("YOUR_LICENSE_KEY_GOES_HERE")
    return true
}
Copy
1
2
3
4
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [PSPDFKit setLicenseKey:@"YOUR_LICENSE_KEY_GOES_HERE"];
    return YES;
}

Display a PDF Document

Copy
1
2
3
4
5
6
7
8
import PSPDFKit

let fileURL = Bundle.main.url(forResource: "Document", withExtension: "pdf")!
let document = PSPDFDocument(url: fileURL)

let pdfController = PSPDFViewController(document: document)

present(UINavigationController(rootViewController: pdfController), animated: true)
Copy
1
2
3
4
5
6
7
8
9
#import <PSPDFKit/PSPDFKit.h>

NSURL *documentURL = [NSBundle.mainBundle URLForResource:@"Document" withExtension:@"pdf"];
PSPDFDocument *document = [[PSPDFDocument alloc] initWithURL:documentURL];

PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:document];

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:pdfController];
[self presentViewController:navController animated:YES completion:NULL];

Note: See the various example projects in the demo download dmg for further details.