Skip to content

Instantly share code, notes, and snippets.

@steipete
Created November 16, 2011 12:44
Show Gist options
  • Save steipete/1369992 to your computer and use it in GitHub Desktop.
Save steipete/1369992 to your computer and use it in GitHub Desktop.
PSPDFKit Appcelerator Example
// create basic UI
Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({
title:'PSPDFKit',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
title:'PSPDFKit',
window:win1
});
var button = Titanium.UI.createButton({
title: 'Open PSPDFKit Example PDF',
top:175,
left:100,
width: 250,
height: 35,
font:{fontSize:16}});
win1.add(button);
button.addEventListener('click',function(event) {
var pspdfkit = require('com.pspdfkit');
var pdfName = "PSPDFKit.pdf";
// var pdfFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'PSPDFKit.pdf');
// pdfName = pdfFile.nativePath;
pspdfkit.showPDFAnimated(pdfName, true, {
"pageMode": "1", //PSPDFPageModeDouble
});
// some supported properties (See http://pspdfkit.com/documentation/Classes/PSPDFViewController.html for a full list of properties. Only BOOL, NS*Integer, CGFloat and UIColor can be converted.)
/*
"doublePageModeOnFirstPage": "YES",
"page" : "3",
"pageScrolling" : "1",
"zoomingSmallDocumentsEnabled" : "NO",
"fitWidth" : "NO",
"maximumZoomScale" : "1.3",
"pagePadding" : "80",
"shadowEnabled" : "NO",
"backgroundColor" : "#FF0000",
*/
});
// commit ui
tabGroup.addTab(tab1);
tabGroup.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment