Appcelerator Titanium Bridge for PSPDFKit for iOS
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Classes
PSPDFKit-Titanium.xcodeproj
Source/PSPDFKit-Titanium-Source.xcodeproj
example
hooks
.gitignore
.project
ComPspdfkit_Prefix.pch
LICENSE
README.md
manifest
module.xcconfig
timodule.xml
titanium.xcconfig

README.md

PSPDFKit for iOS Appcelerator Bindings

PSPDFKit - The Leading Mobile PDF Framework for iOS and Android.

How to build

Note: Read the Alloy section before building the module if you're using the Alloy framework.

  1. Checkout the project: git clone https://github.com/PSPDFKit/Appcelerator-iOS.git
  2. Make sure you have Titanium 7.4.0.GA or later installed: http://www.appcelerator.com
  3. Download the binary build of PSPDFKit from your customer portal: https://customers.pspdfkit.com
  4. Open the downloaded .dmg and copy PSPDFKit.framework and PSPDFKitUI.framework into the checked out folder.
  5. Call appc ti build -p ios --build-only in the Appcelerator-iOS folder.
  6. Unzip the created .zip into the Titanium folder (and optionally remove the .zip afterwards): unzip ./com.pspdfkit-iphone-8.x.x.zip -d ~/Library/Application\ Support/Titanium
  7. Copy PSPDFKit.framework and PSPDFKitUI.framework into your project's Resources/iphone.
  8. Modify your project's tiapp.xml to contain the following entries:
<ti:app xmlns:ti="http://ti.appcelerator.org">
  <ios>
    <min-ios-ver>10.0</min-ios-ver>
  </ios>
  <modules>
    <module platform="iphone">com.pspdfkit</module>
  </modules>
</ti:app>

Note: PSPDFKit 8 for iOS needs at least Xcode 10 or higher and supports iOS 10+.

The ti.dynamiclib module hook in hooks/ti.dynamiclib.js embeds PSPDFKit.framework and PSPDFKitUI.framework into your app. You can find more info about it here.

Using the PSPDFKit module

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"
    }
});

Troubleshooting

'PSPDFKit.h' file not found

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 directories are $(SRCROOT)/PSPDFKit.framework/Headers and $(SRCROOT)/PSPDFKitUI.framework/Headers (recursive).

Build error

[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

Alloy overwrites all files in the Resources folder everytime the application is built. This means you need to copy PSPDFKit.framework and PSPDFKitUI.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_PATHS in module.xcconfig to point to the new folder, for example replace "$(SRCROOT)/../../Resources/iphone" with "$(SRCROOT)/../../Frameworks".
  • Modify hooks/ti.dynamiclib.js to use the new framework path, for example replace ../../Resources/iphone/PSPDFKit.framework with ../../Frameworks/PSPDFKit.framework and ../../Resources/iphone/PSPDFKitUI.framework with ../../Frameworks/PSPDFKitUI.framework.

License

This project can be used for evaluation or if you have a valid PSPDFKit license.
All items and source code Copyright © 2010-2018 PSPDFKit GmbH.

See LICENSE for details.

Contributing

Please ensure you signed our CLA so we can accept your contributions.