2014-12-24 4 views

ответ

2

Пробовали ли вы этот код:

try { 
    var f = Ti.Filesystem.getFile('your.pdf'); 
    Ti.Android.currentActivity.startActivity(Ti.Android.createIntent({ 
     action: Ti.Android.ACTION_VIEW, 
     type: 'application/pdf', 
     data: f.getNativePath() 
    })); 
} 
catch (err) { 
    var alertDialog = Titanium.UI.createAlertDialog({ 
     title: 'No PDF Viewer', 
     message: 'We tried to open a PDF but failed. Do you want to search the marketplace for a PDF viewer?', 
     buttonNames: ['Yes','No'], 
     cancel: 1 
    }); 
    alertDialog.show(); 
    alertDialog.addEventListener('click', function(evt) { 
     if (evt.index == 0) { 
      Ti.Platform.openURL('http://search?q=pdf'); 
     } 
    }); 
} 

взято отсюда: http://developer.appcelerator.com/question/72361/open-pdf-file-on-android

Смежные вопросы