This repository contains the FastPdfKit iOS library with some sample projects.
FastPdfKit is a library that let you show pdf documents in iOS applications bypassing all performances and missing features problems related to QuickLook.
Side scrolling, search with highlighted results, preview and thumbnails, text extraction, overlay views, embedded multimedia, optimization for every device, single and double page are just some of countless features included in FastPdfKit.
For more information, see the FastPdfKit website and the Support website.
- Side page sliding
- Single page
- Double page
- Landscape/Portrait with automode
- Extreme speed
- Native pdf thumbnails extraction
- High definition thumbnails generation
- Page preload
- Double tap and pinch to zoom
- Tap on the side to go forward or backward
- Zoom Lock with animation
- Control zoom level for each page
- Quick page change bar with thumbnails and page numbers
- Bookmarks
- Outline - Table Of Contents personalizzabili
- Left to Right and Right to left reading
- Switch left to right pages
- Shadown on pages customizable
- Padding settable
- Side areas to go forward and backward with custom dimension
- Directional lock
- Custom pdf background
- Precise zoom on annotations and page parts
- Auto mode: single page in portrait and double page in landscape
- Goto page and zoom on rect
- Custom annotation support
- Multimedia documents overlayed over the pages
- YouTube videos
- Local videos
- Streaming videos
- Offline sound reproduction
- Music streming
- Web pages and html5 in overlay
- Custo modal multimedia views
- No limits
- You can customize protocols
- Touchable overlay views
- Draw over pdf layers in page coordinates
- Overlayed UIViews
- Embedded local audio Playerwith pause/play and volume
- Embedded remote audio player
- Embedded movie player with fullscreen option
- Embedded fullscreen browser
- Overlay on Tiled Layer on demand
- Tap and double tap on annotations
- Video and sound with autoplay
- Coordinates conversions
- Sample interactive kiosk
- xml document to get new issues
- Background download
- Ready in 3 minutes
- Download pdf document or zipped archives (.fpk)
- Cover displayed
- Fully customizable
- Text search and result highlight
- List search results
- Look through results and go to the following one
- Text extraction
- Link between pages
- Support for link with urls
- Support for link to external documents
- Search with word selection and results skimming
- Zoom on results
- Multibyte charachters supported
- Customizable search and profiling
- True PDF
- Free version for low budget projects with complete features
- Fully multitouch
- Large document support
- Retina Display optimization
- Customizable interface
- Support for encrypted documents
- Works on every iOS version since 3.2
- Universal Binary
- Destination named urls
- Get cropbox and rotation for each page
- Compatibility mode for older devices
- Three sample projects with highly commented code
- Ready to use interface for immediate deploy with framework and library
- Complete documentation
- View pdf in subview or in standard views stack
- Every feature optimized for iPhone
- Every feature optimized for iPad
- Library and examples source code available on github
- Works with Xcode 3.2.6 and 4.x
- Open PDF documentsfrom file and fromNSDataProvider
- Smart caching pdf
- Open multiple pdf documents at once
- Complete delegate feedbacks
- Support for UIGestureRecogniser
- Multi-Threading is used to achieve maximum speed
- Automatic and optimized caching system
- Become a Reseller
- How fits your needs
- Free for selected no-profit organizations
- 100+ applications already developed in 20 countries
- Tens of Partners
In the Xcode project you'll find some targets
- FastPdfKit: framework with everything needed to add just the reader to your app;
- FPKKioskApp: a Kiosk project with document download and ready to use reader class;
- FPKSimpleApp: a basic project with custom reader;
- FPKReaderLib: a static library with the
ReaderViewController
and its dependencies; - FPKKioskLib: a static library with the kiosk classes;
- FPKioskBundle: bundle of resources for needed for the kiosk;
- FPReaderBundle: bundle of resources for needed by the
ReaderViewController
.
In FastPdfKit.framework and FPKReaderLib the libFastPdfKit.a
that contains the compiled core rendering engine.
All the other classes are public and can be customized or subclassed at will.
Every target can be compiled and recompiled for your needs.
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
documentName
to the corresponding name; -
Call the
actionOpenPlainDocument
method to open the document; -
Enjoy.
- Renamed a few c functions to avoid conflicts.
- Minor fixes.
- More stability fixes.
- Stability fixes.
- Added exact match option to search.
- Added exact match and ignore case switch to SearchDisplayViewController.
- Updated text extraction algorithm.
- Exposed pdf rendering settings.
- Tweaks and bugfixes.
- Added an xmlURL property to the Kiosk MenuViewController to customize the list without subclassing.
- Security framework added in xcconfig.
- Improved handling of space glyph in the text
- Bunch of small tweaks and fixes
- Fixed a crash while reading certain documents annotations
- Finally fixed layer shadow (again)
- Fixed bad overflow mode page position with some documents
- Sligthy changed starting page behavior, now the slider should update properly
- Added a visited page system similar to web browser one, check the MFDocumentViewController.
- You can now set the thumbnail and image cache folders
- Fixed missing iPhone toolbar images
- Thumbnails are now JPEG
- Added cache encryption, check MFDocumentViewController's cacheEncryptionKey for details. Security.framework is now REQUIRED.
- Shadow offset now takes padding into account
- Uninitialized rect in background op fixed
- Solved rootViewController nil property for window in the app delegate (prevent correct behavior on iOS6)
- Page shadows are back
- Added cocoaAnnotationsForPage: method to MFDocumentManager to get more Cocoa-friendly annotations data from the pdf
- Fixed a bunch crash
- Fixed a few memory leaks (one quite large)
- If you dont see Chinese, Japanese or Korean text extracted, please download, unzip and add the CMaps for the language. You can get them here http://partners.adobe.com/public/developer/font/index.html
- There are a few more options for the embedded thumbnail scroll view and page slider, and you can also choose the label for the individual page
- Fix for password protected documents not working anymore
- Removed some warnings;
- Updated Extensions;
- Fixed episodical crashes.
- Added a new pdf engine. It is enabled by default. You can switch back to the old version by untick the appropriate option in the Settings (this will be available until the final release). Feedback on performances is welcomed.
The new version will attempt to cache pdf page images. If no documentId
is set in the MFDocumentViewController
, the default folders are in Library/Caches/shared, otherwise the cache is located in Library/Caches/.
Default settings should provide good performance on all devices, from the first iPad to the new one. Thumbnails generation has been moved inside the lib. Customization options for the thumbnail scroll view will be available in the final version.
- Fixed occasional crash with dual core devices on startup
- New rendering approach just for the new iPad (and its weak A5X CPU)
- Page thumbnails created for Retina Display on the new iPad
- Core Library built with Xcode 4.2 and iOS 5.0 to avoid poor performances caused by a (reintroduced) CATiledLayer.
- Alternate uri definition for modal annotations
- Added a supportedOrientation attribute to allow change of supported orientation at runtime
- Added alternate schemes (prefixes) for annotations' uri
- Improved support for the new retina iPad
- Fixed (contained) a crash occurring when the pdf provokes a transform stack buffer underflow
- Changed font cache again. This should avoid a few cases of creshes due to an NULL font name;
- Removed a few debugging logs
- Added support to remote link in the ToC/Outline
- Internal document links work again
- Fixed tiled overlay view flag being ignored
- Removed unneeded operator in the pdf scanner
- Changed pdf detail view timings
- Less aggressive tiled view rendering
- Fixed a bug in the glyph name matching function
- Better caching of annotations
- Removed a few more synchronization point between main thread and worker th
- New Extended target that supports Extensions;
- Out of the box supported Extensions:
- FPKPayPal to create catalogs with items that can be purchased directly from the app;
- FPKYouTube to place YouTube video on the page.
- FPKGallerySlide interactive image gallery with manual or automatic advancement;
- FPKMap to render an interactive google map;
- FPKGalleryFade image gallery useful for the table of contents;
- FPKGalleryTap to create a multi interactive image gallery;
- FPKMessage to show details or alerts;
- FPKWebPopup to open a web page in a popup view;
- Updated documentation to version 3.2
- Included Extensions documentation
For more informations reagarding Extensions git.io/fpke.
- Reworked page metrics synchronization to reduce lag on slow pdfs (more to come).
- Paged scroll view attribute is accessible again in the MFDocumentViewController public interface.
- FPK annotations parsing can be disabled by setting MFDocumentViewController's fpkAnnotationsEnabled to NO. Use this if you experience frequent freezes while skimming the pages.
- You can add multiple MFDocumentViewControllerDelegates by calling MFDocumentViewController's addDocumentDelegate: (and removeDocumentDelegate:). Check the interface for details
- Non-unlocked password protected douments should no more crash the application.
- Cordinates for taps on the right page are now correct.
- Fixed a bug involving multibyte fonts compromising search, introduced with unicode normalization.
- Few memory leaks in ReaderViewController.
- Overlay views are enbaled on any license again.
- Newstand is disabled as default due to a memory leak in the download procedure.
- Variable number of preview image. Check MFDocumentViewController header.
- View size of the reader is now appropriate for the screen configuration (status bar only).
- Added missing dismiss button in ReaderViewController on iPhone.
- Reverted to optional tiled overlay view (used for search resulth highlight). This seems to have fixed most 'crashes' (app bein killed actually) while zooming onto a page.
- A few memory leaks inside the unicode normalization data structures have been fixed.
- Different handling of document view controller dismissal. It is no more necessary to call -cleanup on the MFDocumentViewController before relasing it. Actual method implementation does nothing.
- Quite a few small memory leaks fixed.
- Faster page redrawn on page transition (goToPage, setPageMode, etc.).
- MFHomeListPdfs is now BookItemView, be careful if you used to subclass the former in your project.
- Fixed a few errors in Win ANSI and Mac OS Roman encoding. For example, the Unicode character 'LEFT SINGLE QUOTATION MARK' U+2018 will no more be replaced by other characters.
- Changed font cache management. If you still get problem with [] (notedef) caracter in the text extracted, the cache might be the issue. Set MFDocumentManager's fontCacheEnabled property to NO.
- Unicode sequences will now be handled as such and the lib will no try (and fail) to compose them to a single unicode codepoint (it is related to search and extraction of text).
- Lib will now attemp to compose multibyte characted to a single codepoint for search and extraction.
- Added support to 14 (-2) Adobe Standard Fonts. If you get page empty, blank pages at text extraction check the simulator log and if the font marked as uncompleted is named like one of the files in the FPKCore/standard14fonts folder add that font to your application bundle.
- Font cache re-enabled. This time seems to work as expected.
- Default zoom not being set fixed (again).
- Search and extraction will not crash when certain characters are found. Instead a .notdef (usually it looks like an empty rect) value with be appended to the text.
- Enhanced search and extraction with Unicode composition and decomposition.
- Added search match modes:
- Return an array of
MFTextItem
representing the matches of teh search term on the page passed as arguments. It is a good choice running this method in a secondary thread. FPKSearchMode
has the following values:FPKSearchModeHard
- if you search for 'bèzier' it will match 'bèzier' only but not 'bezier'. If you search for 'bezier' it will match 'bezier' only.FPKSearchModeSoft
- if you search for term 'bèzier' it will match both 'bezier' and 'bèzier'. Same if you search for 'bezier'.FPKSearchModeSmart
- if you search for term 'bezier', it will also match 'bèzier', but if you search for 'bèzier' it will match 'bèzier' only.- Ignore case is self explanatory.
- Default parameters are
FPKSearchModeSmart
andignoreCase
toYES
.
- Return an array of
- Internal changes of the view hierarchy to provide more flexibility and overlay transitions.
- Revamped
ReaderViewController
user interface. - Better thumbnail scroll view and generation.
- Added support to video overlay control parameters in the uri.
- Search now works for terms of unitary length.
- Added a method to retrieve annotations from the document and provide them as overlays.
- Slightly changes to
MFDocumentViewControllerDelegate
callbacks. - New activation method with key FPKLicenseKey from Info.plist: no need to pull to get the activated version.
Disabled the 2.1.1 font cache due to an implementation oversight. Will be re-introduced as soon as it will behave as expected.
- Cleaned up text search and extraction a little bit. More fixes incoming.
- Added a font cache system for text extraction and search, which should give sensible improvement in search speed especially on documents with a large amount of different fonts.
- Added Overflow page mode to previous Single and Double. Basically, the pdf page will now fill the screen along its width, overflowing under the bottom of the screen if necessary.
- Added autoMode property. It will tell the MFDocumentViewController to what mode switch when in landscape if automodeOnRotation is YES. Default is MFAutoModeDouble, other option are MFAutoModeSingle and MFAutoModeOverflow.
- Fixed a bug in the transformation returned on double page mode for page with an angle not equal to 0.
- Added guard to iOS 4.x only methods.
- Added support to link annotation with Remote Go-To actions.
- Updated manual with latest methods.
- Added methods to convert points and rect to and from different coordinate systems. Take a look at the MFDocumentViewController for details.
- Documented the method to get the cropbox and rotation angle for each document page.
- Finally fixed the bad behavior of the detail (tiled) view on retina device.
- Fixed a bug involving rendering of the preview pages at low res on retina display introduced a few updates ago.
- The -didGoToPage callback is now called once when a page is changed on user scroll input.
- Bleeding of the pdf cover images fixed.
- The embedded UIWebView is now embedded a bit better.
- Multimedia support
- Reorganized project
- Many other improvements
If you have any other question please post it in the Support Site