How open pdf in Air for Android/Black berry
I want to open pdf in Air for Android/Black berry.
How i do that?
I use AIR 2.6 and IDE is Flash Builder 4.5.
StageWebView.
http://help.adobe.com/en_US/as3/dev/WS901d38e593cd1bac3ef1d28412ac57b094b-8000.html
Example copied from the link above:
package {
import flash.display.MovieClip;
import flash.media.StageWebView;
import flash.geom.Rectangle;
public class StageWebViewExample extends MovieClip{
var webView:StageWebView = new StageWebView();
public function StageWebViewExample() {
webView.stage = this.stage;
webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight );
webView.loadURL( "http://www.adobe.com" );
}
}
}
The StageWebView is the solution #1.
However, this won't work on Android 3 tablets. For activating any plugin (e.g., Flash or PDF) in the StageWebView you need to explictely enable hardware acceleration in the description file. This part would be easy, but Flash CS 5.5 would not package your -app.xml since it checks against the Froyo lib and not the Honeycomb lib. Since the hardwareaccelartion is a feature of Honeycomb, it is unknown for CS5.5.
Here is an immediate need for updating your products Adobe!!!!
So do it with the StageWebView but keep your tablet friends in mind. Give them a message at least.
On android if adobe reader is installed this seems to work:
var oFile:File = new File ( File.documentsDirectory.resolvePath ( "filepath/test.pdf" ).nativePath );
var oUrl:URLRequest = new URLRequest ( "file://" +oFile.nativePath );
navigateToURL ( oUrl );
The important and poorly documented part is prepending "file://" to the path.
精彩评论