Three minutes implementation guide
This guide is also available as screencast number 4.
- Clone the repository from github or just grab the compressed archive;
- Open your existing project in Xcode;
- Open the downloaded folder in the Finder and locate FastPdfKit.embeddedframework;
- Drag the framework on the Xcode workspace;
- Inherit the project options: select the Project an from info tab and configurations line choose FastPdfKitFramework from the drop down list;
- Open the framework's Resource folder and locate the Snippets.txt document;
-
Copy in you controller interface these lines:
#import <FastPdfKit/FastPdfKit.h> @class MFDocumentManager; -(IBAction)actionOpenPlainDocument:(id)sender; -
Copy in your controller implementation these other lines:
-(IBAction)actionOpenPlainDocument:(id)sender{ /** Set document name */ NSString *documentName = @"Manual"; /** Get temporary directory to save thumbnails */ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); /** Set thumbnails path */ NSString *thumbnailsPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",documentName]]; /** Get document from the App Bundle */ NSURL *documentUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:documentName ofType:@"pdf"]]; /** Instancing the documentManager */ MFDocumentManager *documentManager = [[MFDocumentManager alloc]initWithFileUrl:documentUrl]; /** Instancing the readerViewController */ ReaderViewController *pdfViewController = [[ReaderViewController alloc]initWithDocumentManager:documentManager]; /** Set resources folder on the manager */ documentManager.resourceFolder = thumbnailsPath; /** Set document id for thumbnail generation */ pdfViewController.documentId = documentName; /** Present the pdf on screen in a modal view */ [self presentModalViewController:pdfViewController animated:YES]; /** Release the pdf controller*/ [pdfViewController release]; } -
Choose a pdf from the finder and drop it in the project;
- Change the
documentNameto the corresponding name; - Call the
actionOpenPlainDocumentmethod to open the document; - Enjoy.