Using RDIntegration Library

RDIntegration library lets your app interact with PDF Expert on iPad. Using this library you'll be able to open PDF files in PDF Expert from your own application. Also there is an option that allows your app to receive modified file back.

The library does not use standard “Open In” dialogs keeping user expirience clean and simple. Users may launch PDF Expert with required file just by touching single button.

Integration Flow

Let's consider there is Your app and PDF Expert. Your app has a PDF file which needs to be viewed and/or edited within PDF Expert. You have a few options:

We call a PDF file “flattened” when additonal annotations are embedded in the body of PDF file. Viewing of this kind of files is supported by iOS system libraries.

Preparing RDIntegration library

First you need to prepare RDIntegration library for using inside your project. RDIntegration library consists of one binary file ‘libRDIntegration.a‘ and one header file ‘RDIntegration.h‘. Please copy these files into your project.

Opening PDF file in PDF Expert without returning back modified PDF

To open a PDF file in PDF Expert use the following code:

        - (void)openIn:(NSString *)userInfo {
            NSString *fullpath = userInfo;
            RDIntegration *integration = [RDIntegration sharedIntegration];
            [integration openFile:[NSURL fileURLWithPath:fullpath] inApp:RDIntegrationAppPDFExpert error:nil];
        }
        

Editing PDF file in PDF Expert with returning back the modified PDF

1. Register the URL entry:

  • Add an entry to URL Types. The identifier must have suffix -rdiback, e.g. com.company.appname-rdiback.

  • Set the URL Schemes entry in accordance to your application name and with suffix back: e.g. applicationback.

  • 2. Add the following code to edit the file in PDF Expert and receive a not-flattened file back:

            - (void)editInRaw:(NSString *)userInfo {
                NSString *fullpath = userInfo;
                RDIntegration *integration = [RDIntegration sharedIntegration];
                [integration editFile:[NSURL fileURLWithPath:fullpath]
               					inApp:RDIntegrationAppPDFExpert
      				   withFlattening:NO
               					error:nil
            				 userInfo:userInfo];
            }

    To receive a flattened file back set withFlattening: to YES.

    3. To receive back the edited PDF file:

            - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation 
    	{    
    		BOOL handledByRDIntegration = [[RDIntegration sharedIntegration] handleOpenURL:url];
    		
    		if (handledByRDIntegration)
    			return YES;
    		// regular openURL code
    		
    		return YES;
    	}

    File Replacing Strategy

    A few words should be mentioned about replacing existing files. Decision on replacing files is made on the basis of their modification dates. If you send some pdf file to PDF Expert which already contains the file with the same name, few variants are possible:

    For the example of the RDIntegration library usage please refer to RDIntegration sample Xcode project.