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 trying the PSPDFKit trial for evaluation purposes. If you don't have a trial license yet, fill out the trial form to get one after confirming your email address.

1 Integrate the PSPDFKit framework:

The easiest way to get started is using CocoaPods. Add the following to your Podfile, 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.

2 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;
}

3 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 documentWithURL: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.

Was this page helpful? We're happy to answer any questions.