How Do I Present a PSPDFTabbedViewController in Cordova?

Our Cordova library was designed to present a PDFViewController modally. If your use case requires you to present a PDFTabbedViewController, you can extend the library in your own fork, as shown below.

1. Update pspdfkit.js

Declare presentTabs in pspdfkit.js, like this:

this.presentTabs = function (path, callback) {
		function (result) {
			if (callback) callback(result);
		function (error) {
			if (callback) callback(error);

2. Update PSPDFKitPlugin.m

Implement the newly declared API in Objective-C, like so:

- (void)presentTabs:(CDVInvokedUrlCommand *)command {
    NSArray *paths = [command argumentAtIndex:0];

    PSPDFTabbedViewController *tabbedViewController = [[PSPDFTabbedViewController alloc] init];
    NSMutableArray *documents = [NSMutableArray new];
    for (NSString *path in paths) {
        PSPDFDocument *document = [[PSPDFDocument alloc] initWithURL:[self fileURLWithPath:path]];
        if (document) {
            [documents addObject:document];
    tabbedViewController.documents = [documents copy];
    _navigationController = [[UINavigationController alloc] initWithRootViewController:tabbedViewController];

    if (!_navigationController.presentingViewController) {
        [self.viewController presentViewController:_navigationController animated:YES completion:^{

            [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK]
    } else {
        [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]

3. Usage

This is how the newly added API would look in your Cordova JavaScript code:

	'pdf/PSPDFKit 8 QuickStart Guide.pdf',
Overlayed Save Button

For more information, refer to our How to Expose Native iOS APIs to Cordova blog post.