hansemannn / titanium-pspdfkit-ios

A refactored version of the (awesome) PSPDFKit iOS module for Titanium using pure Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PSPDFKit for Titanium iOS

The repository contains the WiP of the revamped PSPDFKit module for Titanium. It represents an example of using the new Swift-based module-architecture in Titanium by showing common usages and best practices for modern Titanium module development.

⚠️ The module is currently WiP and should not be used in production, yet!

Getting Started

Carthage (Recommended)

  1. Change the API key inside the Cartfile to match your PSPDFKit API key
  2. Run carthage update to update the project dependencies
  3. Run carthage build --platform iOS to build the project dependencies
  4. Copy the resulting frameworks PSPDFKit.framework and PSPDFKitUI.framework to platform
  5. Done!

Manual

  1. Download your copy from here
  2. Unzip and copy the resulting frameworks PSPDFKit.framework and PSPDFKitUI.framework to platform
  3. Done!

Example

import PSPDFKit from 'ti.pspdfkit';

// Set your license key
PSPDFKit.licenseKey = 'YOUR_LICENSE_KEY';

const win = Ti.UI.createWindow({
    backgroundColor: '#fff'
});
 
const btn = Ti.UI.createButton({
    title: 'Open PDF Document'
});

const document = Ti.Filesystem.getFile('PSPSDKit.pdf');
 
btn.addEventListener('click', () => {
    // Show our PDF document
    PSPDFKit.present(document, {
        documentLabelEnabled: true
    });
});
 
win.add(btn);
win.open();

Build the Module

appc run -p ios --build-only

Author

Hans Knöchel

License

MIT

About

A refactored version of the (awesome) PSPDFKit iOS module for Titanium using pure Swift.

License:MIT License


Languages

Language:Swift 55.8%Language:JavaScript 26.7%Language:Objective-C 9.9%Language:Ruby 7.7%