PSPDFKit - The Leading Mobile PDF Framework for iOS and Android.
Note: Read the Alloy section before building the module if you're using the Alloy framework.
- Checkout the project:
git clone https://github.com/PSPDFKit/Appcelerator-iOS.git - Make sure you have Titanium 6.0.4 GA or later installed: http://www.appcelerator.com
- Download the binary build of PSPDFKit from your customer portal: https://customers.pspdfkit.com
- Open the downloaded .dmg and copy
PSPDFKit.frameworkinto the checked out folder. - Call
appc ti build -p ios --build-onlyin theAppcelerator-iOSfolder. - Unzip the created .zip into the Titanium folder (and optionally remove the .zip afterwards):
unzip ./com.pspdfkit-iphone-6.x.x.zip -d ~/Library/Application\ Support/Titanium - Copy
PSPDFKit.frameworkinto your project'sResources/iphone. - Modify your project's
tiapp.xmlto contain the following entries:
<ti:app xmlns:ti="http://ti.appcelerator.org">
<ios>
<min-ios-ver>9.0</min-ios-ver>
</ios>
<modules>
<module platform="iphone">com.pspdfkit</module>
</modules>
</ti:app>Note: PSPDFKit 6 for iOS needs at least Xcode 8 or higher and supports iOS 9+.
The ti.dynamiclib module hook in hooks/ti.dynamiclib.js embeds PSPDFKit.framework into your app.
You can find more info about it here.
To use the module in code, you will need to require it, before using it.
var pspdfkit = require('com.pspdfkit');
var pdfView = pspdfkit.createView({
filename : 'PSPDFKit.pdf',
options : {
pageMode : 0, // PSPDFPageModeSingle
pageTransition : 2 // PSPDFPageCurlTransition
},
documentOptions : {
title : "Custom Title Here"
}
});If PSPDFKit.h can't be found you need to add the directory that contains PSPDFKit.h to the "Header Search Paths" build setting in the Xcode project (PSPDFKit-Titanium.xcodeproj). The correct directory is $(SRCROOT)/PSPDFKit.framework/Headers (recursive).
[ERROR] : ** BUILD FAILED **
[ERROR] : The following build commands failed:
[ERROR] : Ld build/Products/Debug-iphonesimulator/PSPDFKit-Appcelerator.app/PSPDFKit-Appcelerator normal x86_64
[ERROR] : (1 failure)If you get the above build error when running the project, you likely forgot to include the PSPDFKit module in the tiapp.xml:
<modules>
<module platform="iphone">com.pspdfkit</module>
</modules>Alloy overwrites all files in the Resources folder everytime the application is built. This means you need to copy PSPDFKit.framework into a different folder than the default Resources/iphone, for example Frameworks. You also need to do the following before building the module:
- Modify
FRAMEWORK_SEARCH_PATHSinmodule.xcconfigto point to the new folder, for example replace"$(SRCROOT)/../../Resources/iphone"with"$(SRCROOT)/../../Frameworks". - Modify
hooks/ti.dynamiclib.jsto use the new framework path, for example replace../../Resources/iphone/PSPDFKit.frameworkwith../../Frameworks/PSPDFKit.framework.
This project can be used for evaluation or if you have a valid PSPDFKit license.
All items and source code Copyright © 2010-2017 PSPDFKit GmbH.
See LICENSE for details.