How-To use FastPdfKit on existing projects (old version 1.X)

Add required files to existing project

  • Download and extract the last sample project;
  • Open your existing app XCode project, open Project menu and choose Add to Project… ⌥⌘A, then locate FastPdfKit folder inside the downloaded package and click Add ( this folder include the file MFDocumentViewController.h, libFastPDFKit.a and many other file ), be sure to check Copy items into destination group’s folder (if needed);
  • Right click on the Framework group and select Add and then Existing Framework…, then choose QuartzCore.framework from the list and press Add;
  • With the same method add all these frameworks: UIKit.framework, CoreText.framework, libz.1.2.3.dylib, AVFoundation.framework, MediaPlayer.framework, CFNetwork.framework, AudioToolbox.framework, Foundation.framework and CoreGraphics.framework.
  • At the end of this steps youu must have this situation
  • Start coding
  • Choose or add a new controller (we will call it LauncherController) to manage pdf documents and in the .h file add and add lines 3 and 7 to the controller

       //  LauncherController.h
       #import <UIKit/UIKit.h>
       @class MFDocumentManager;
       @interface LauncherController : UIViewController {
    
       }
       -(IBAction)actionOpenPlainDocument:(id)sender;
       @end
    
  • Add this code before the @implementation line in the .m file

       #import "MFDocumentManager.h"
       #import "MFDocumentViewController.h"
       #define DOC_PLAIN @"FastPdfKit-1.0RC1"
    
  • Implement at least this method in the .m file

       //  LauncherController.m
       -(IBAction)actionOpenPlainDocument:(id)sender {
           NSString *documentPath = [[NSBundle mainBundle]pathForResource:DOC_PLAIN ofType:@"pdf"];
           NSURL *documentUrl = [NSURL fileURLWithPath:documentPath]; 
           MFDocumentManager *aDocManager = [[MFDocumentManager alloc]initWithFileUrl:documentUrl];
           MFDocumentViewController *aDocViewController = [[MFDocumentViewController alloc]initWithDocumentManager:aDocManager];
           [self presentModalViewController:aDocViewController animated:YES]; 
           [aDocViewController release];
       }
    
  • Now call the above action to open the pdf. You can find the code above with comments in the BasicLauncherController class.

  • Within FastPdfKit folder there are many other sample controllers (in the Controllers group) where you can find methods (heavily commented) to manage every feature.