Viewing PDF's
Can you view PDF's inside a Titanium App or would making them jpgs be the way to go?
6 Answers
-
evalJS seams to be broken in Titanium on iOS 5.
-
You can display them using a webview.
See
web_views.js
in KitchenSink. -
Hello, I executed the example present in kitchenSink but it show only the first pdf page whitout possibility to zoom in and out or change page.
It's a my problem?? -
You can view PDFs in Android by utilizing Android Intents. This blog post shows you exactly how to do this with Titanium: http://developer.appcelerator.com/blog/2011/09/sharing-project-assets-with-android-intents.html
-
@Mitul Bhalia
I've tried this code as you mentioned
(Note: my url is ending with pdf extention)var xhr = Ti.Network.createHTTPClient(); xhr.open("GET", MyUrl.pdf); xhr.onload = function() { Ti.API.info('onload'); try { var wb = Ti.UI.createWebView(); wb.data= this.responseData; Ti.API.info(this.responseData); Titanium.UI.currentWindow.add(wb) } catch(r) { alert(r) } } xhr.send();
it hang-up when entering
xhr.onload = function()
evenTi.API.info('onload');
is not printed -
just try to download that pdf file using httpClient method and on its response set
webview.data = this.responseData;