Displaying PDF content in Android Air app - how?

Hi, I'm fairly new to developing Air apps for mobile devices. I'm looking to have my app display PDF files and can't find a dfinitive way of doing it. I've read that using the StageWebView would be the way to do it.
Here's the relevant part of my code (PDF path changed):
if (StageWebView.isSupported)
currentState = "normal";
webView.stage = stage;
webView.viewPort = new Rectangle(20, 100, 450, 450);
webView.addEventListener(LocationChangeEvent.LOCATION_CHANGE,onURLChange);
webView.loadURL("http://path.to.my.pdf");
addEventListener(ViewNavigatorEvent.REMOVING,onRemove);
else {
currentState = "unsupported";
lblSupport.text = "StageWebView feature not supported";
Its working up until the point of actually displaying the PDF content, I get nothing (blank screen).
I'm using Flash Builder 4.5 / Air 2.6 and debugging on a Motorola Xoom tablet. Adobe Reader is installed on the device.
Any help with this would be greatly appreciated.

Solved.
For some reason I couldn't access the HTMLLoader object outside of the function that initialised it, despite the fact that I was listening for EVENT_COMPLETE.
Basically, to get round this bug, just put all the initialise and load code in the same function and you should be laughing.

Similar Messages

  • Displaying PDF content in Adobe Air 3.2

    Hi all,
    I'm trying to render a locally stored sample pdf using Air 3.2 on Win7 64bit.
    I'm not getting any error messages and I'm pretty sure the content is being loaded.. but the actual content of the pdf is not displayed when I add it to the stage.
    I just get a white screen in the app.
    I haven't explicitly scaled or rotated the content, just set the width and height of the html component as directed in the livedocs.
    Dan

    Solved.
    For some reason I couldn't access the HTMLLoader object outside of the function that initialised it, despite the fact that I was listening for EVENT_COMPLETE.
    Basically, to get round this bug, just put all the initialise and load code in the same function and you should be laughing.

  • Adobe Acrobat PDFs is not in my apps, how do I add it in 4.0

    Adobe Acrobat PDFs is not in my apps, how do I add it in 4.0

    See these links;
    -> Aldo on Audiobooks
    -> How do I get my audiobook to appear in the Audiobooks menu on my iPod?

  • Needed. Android Air app to watch live FMS video stream.

    Does anyone have an Android Air app that can be used to watch a live video stream from Flash Media Server?
    I've been trying to get our live stream viewable on Android devices and can't find any solutions.
    Thanks,
    Dave

    Hey, I am having the same issue.  Did you find a solution?

  • How to launch PDF in Acrobat from AIR app?

    I'm porting an AS3 app to AIR -- one of the requirements is that an external PDF file be launched with Acrobat -
    I know that  AIR can display PDFs internally, but it's too late to change project specs. 
    I was using fscommand and a .bat file (this will be run on Windows), but that won't work under AIR.
    I am currently using navigateToURL() and using the AIR-resolved url -- this opens the PDF in a browser -- I'd like to have it open in Acrobat.
    Thanks for any help -- this is critical to finishing project.

    This won't work on files in the application directory?   It's not working for me --  The PDF is bundled into the AIR app --
    See http://stackoverflow.com/questions/4050898/openwithdefaultapplication-fails-on-files-in-ap plication-folder

  • Using browser javascript to copy selected text from a pdf file opened in Air app.

    I have posted this question on reader forum as well, but I think it is more suited here...
    I am trying to create a note-taking application in air. I want to extract selected text from pdf file as a string object or to the clipboard.
    Obviously, all pdfs in my local storage will not be scripted to recieve postMessages and act accordingly, and that is not practical either. So, my problem is, how can I copy the selected text in the pdf file (opened as an object in htmlloader within my Air app) to clipboard or directly in another control by say clicking a button in air application? I suppose, this is possible using javascript, however, I don't know which reader methods are exposed to the wrapper htmlloader control. In short, I want to execute app.execMenuItem("Copy") command through htmlloader javascript. Any alternate solutions are also welcome.
    This is similar to passing inbuilt commands/methods/functions (of adobe reader) to pdf-reader plugin embedded in a webpage via javascript. This is possible in IE where the pdf is rendered as activex object, and hence JSObject interface of pdf document/reader is accessible to the browser javascript. I have also read that this same JSObject is accessible to VB as interface for IAC, so as the Air is Adobe's own product, I was wondering if equivalent of JSObject is accessible to htmlloader control as well.
    Thanks in advance...
    Mits

    Thank you Thom for your reply...
    from
    http://www.adobe.com/devnet/acrobat/javascript.html
    ...Through JavaScript extensions, the viewer application and its plug-ins expose much of their functionality to document authors, form designers, and plug-in developers...
    As it is explicitly mentioned, that the functionality of adobe reader are exposed for plugin development, I thought someone here might have used external javascript to execute some safe methods in adobe reader. The functionality (i.e. external javascript interface-JSObject) is already available for VB programmers to develop IAC. Further, the Acrobat SDK example called "AcroPDFinHML" shows how one can embed a pdf-reader in a html page and execute some safe methods (like gotonextpage(), zooming etc.) in IE as ActiveX plugin. I have checked it myself for adobe reader 9, and it works perfectly, so there is no security issue as such to implement the same for another browser (like in my case, the htmlloader control in flex/air app).
    I intend to create a note taking application in air, where it is very much required that I should be able to copy selected text from various pdf documents, that are open in my app, and subsequently paste/collect/save the collected notes and process them afterwords (offcourse, from the pdfs that allow me copying text). However, it is not happening for me here. As the pdfs are opened through adobe reader plugin, it does not register the copy command executed by my air app. It registers the system level copy command (by keyboard shortcut Ctrl+C), but my air app has no way to execute the system level copy command programmatically. So I am kind of stuck here...
    Thanks again for your reply. Having known what am I intend to accomplish, any other (may be alternative) solutions will be appreciated nonetheless...
    Mits

  • Can I update my Android AIR app with a non-AIR app?

    A few years ago I published an Android app using Adobe AIR. Now I've created a new version of the app with a different technology (HaxeFlixel / OpenFL) which uses native C++ code.
    The certificate I used for the AIR version is in "p12" format, and it seems that I need to use "jks" format. I tried using a p12 to jks converter I found online, which seemed to work, but when I try to submit the app I get an error saying that the certificates don't match.
    Any suggestions on how I can update the app with a non-AIR app? Is it possible? Thanks in advance.

    I'm still having trouble with this, I asked in the OpenFL forums but nobody responded.
    I converted the p12 file to JKS from the site you suggested (I think I've actually tried it before), and the file was created successfully, the apk compiled fine with the JKS file, but when I try to update the app for Google Play it says "Upload failed
    You uploaded an APK that is signed with a different certificate to your previous APKs. You must use the same certificate. Your existing APKs are signed with the certificate(s) with fingerprint(s):"
    When I try to sign with the original p12 file, I get the error "Invalid keystore format"
    I noticed that for the AIR app, I also had a file called SelfSigned.pfx, which I think was used to create the p12 certificate? Can this have something to do with the problem? I even tried using this pfx file to sign the app, which didn't work either.

  • Displaying fb Friends in Adobe AIR app

    First off, I realize I'm completely in over my head here.
    I am a designer... not a programmer.  Sure, I've set up some "quizzes" on facebook... but nothing like what I'm trying to do here.  So, I'm hoping to get some quick and simple help from someone here.
    Anyway... here's my problem...
    I've made a fun little Adobe AIR app using Flash CS4.  When ran it makes your computer screen look like you're logging into the Umbrella Corporation from the Resident Evil franchise.  It has company data, surveillance cameras and other stuff.  It's totally for fun and doesn't "do" anything.  Just wanted to make an AIR app late one night and this is what I did.
    Now, however, I would like to make it so that you can login to your facebook account and then view a "database of Umbrella Employees"... which... in reality... would simply be a list of your facebook friends with pictures!  The descriptions of what they "do" could be randomly generated from a file or something... or it could be grabbed from some posts they've made or something.  But the friend pictures and names are really what I'm wanting to show.
    I have looked and looked all over for a simple "downloadable" example of this.  I've found some things, but everything is like reading an encyclopedia... and, like I said, I'm simply not that smart.
    Does anyone have a Flash CS4 .fla file that you could share with me to show me how to do this?
    I'm serious when I say I can't figure much out... so please include all library files and anything else I need to know (like upload this to your server here) and stuff.
    If you help, and I "release" this (obviously I can't make money on it) I'll put an Easter egg in for you with your profile or picture or whatever you like!
    Here's hoping for some help...
    Noel

    start here: http://code.google.com/p/facebook-actionscript-api/

  • Question about display PDF content

    Hi,
    I'd like to show the content of a PDF file directly in a page region, without having to open the Acrobat reader in the same window and hide all the tabs, other regions...
    I am not sure whether this is feasible with HTMLDB, so would like to know that to avoid spending lots of time in no avail.
    Thanks in advance.

    I know it will be hard to make a report or other things to be generated to PDF version. However I only need to display the contents of PDF for now.
    As you guys suggested, I've tried to use frameset. After I created a frame page with Frontpage, I copied the HTML into a HTML type region:
    <frameset cols="356,*">
    <frame name="contents" target="main" src="new_page_5.htm">
    <frame name="main" src="new_page_6.htm">
    <noframes>
    <body>
    <p>This page uses frames, but your browser doesn't support them.</p>
    </body>
    </noframes>
    </frameset>
    However it didn't show anything at all. May I have a more elaborated explanation. Sorry I don't have much experiences with HTML.
    Thanks.

  • 3D Android Air Apps

    Hi everyone I am currently part of a group of students which is creating an Android Air Application.
    We have been doing pretty well so far (we are creating a game which is a periscope simulator) but getting 3d models in the app has been a bit troubling.
    We have been using 3dsMax for the models and using Swift3D in order to convert the file to swf. We then rendered the ship and exported to .swf and then added it to the project in flashbuilder and then used SWFLoader to add it to the app. When we use the emulator the ship which we rendered appears perfectly but when we create the apk and put it on our phone (HTC EVO 4G) the only thing that appears is an old school image not able to be shown image.
    First off we have been doing lots of research on what we could do with the 3d models and everyone has told us that we have to convert them to an .swf in order get in the 3d model because their is no other way to get it in. Is this true or do we really have to use swift3d? Others have suggested that we use some of flashes game engines but would any of these even be compatible with adobe air?
    All we really need to do is import the 3d model then be able to randomly generate its location on the screen as well as its viewing angle. Our application is never actually moving its just providing a still image which is randomly chosen from the 360 degree view of the ship.
    If anyone has any advice we would really appreciate it. At this point we are not really sure what we should do.

    I've not tried any Swift3D but have run some Papervision3D stuff in AIR on Android.  Seems fairly happy but I'm only pushing around simple planes (card game) so the load isn't particularly heavy - more complex models might start to grind it.   Seems to benefit well from GPU acceleration so keep that in mind.  From your description though it sounds as though you're not going to be rendering high fps, which is the real killer, so this may be perfect for your app.
    On PV3D against Alternativa, (broad statement warning) I think it's generally agreed that PV3D is fast, Alternativa is more precise.  PV3D being optimised for speed may be key on Android devices - depends what you're trying to do, but with PV3D you will probably sacrifice some more accurate z-sorting that Alternativa can provide.  Personally I'd test both to see pros and cons - it's going to be on a case by case basis.
    If you've got a more recent version of Swift3D, I believe you can export to a PV3D scene quickly and easily with no knowledge of that engine.  Think it's one of the publish options (v6+ ?).  So presumably you can run a PV3D test on your app with little effort and you can take it from there.  If it's all z-fighting issues on your models, give it a go with Alternativa.
    hth

  • Display PDF document from Servlets to browser - how 2 change the title

    Hi, need help of changing the html title when Display PDF document from Servlets to browser. By default the browser's title shows the obsolute URL where the rdf comes from (i.e. http://www.google.com/sample.pdf), because servlet responds a binary data (PDF), there seems to be no other way to change the browser's title to fit my own choice.
    Appreciate your quick help,

    You can try and check with
    .setTitle("Welcome");

  • Flash CC - Publish iOS/Android AIR App stuck at 5 seconds

    I have a few Flash made apps, I've published them to my devices before, but now I can't. Flash get's stuck at 5 seconds. Flash freezes, I can't cancel.
    Any suggestions?

    I would recommend to use "Captive".
    Difference is pretty simple...
    Shared Basically means that it compiles the "apk" without the Adobe AIR runtime, resulting in a smaller file size apk but REQUIRES users to have the "Adobe AIR App" installed.
    Captive means that it compiles the "apk" with the Adobe AIR runtime, resulting in a larger file size apk but DOES NOT REQUIRE users to have the "Adobe AIR App" installed.
    If you want to Guarantee everyone can run your app, use captive. If you want to rely on users to hope the have the correct version of AIR installed to view your app, use Shared.

  • Facing problem to display the content in Android Emulator of my mobile app

    Hi All,
    I have developed an adf mobile application as in the following and i successfully deployed my app in android emulator.....
    Link i have used to create basic mobile App ------------ http://docs.oracle.com/cd/E18941_01/tutorials/MobileTutorial/jdtut_11r2_54_2.html
    Problem :
    i can view my app in android emulator.......but if i open it i am getting a blank (white) screen in emulator......i don't know wat's happening.
    Can any one please help me to solve this problem.........
    Regards,
    Nani

    Hi,
    Yes Android emulator is very problematic, and there are certain out of box emulator configurations that would not even start up on a reasonably powerful PC.
    What works typically for me is to use an emulator built using SDK version 15 or 16 - for some reason, the Android SDK API level's emulators are much more problematic than before. There are some configurations (for example Nexus 7 tab) that simply hangs when trying to start it using default RAM allocation. After reducing it to 512, I can start it but then I can't start app. With older version of the emulator, if I set the RAM to say 512, generally the emulator will start and the app will also start (although very slowly).
    Unfortunately this is an Android issue, and there is very little ADF Mobile can do.
    In short, if possible please deploy to a device, and also please remember to deploy in release mode when you don't need to debug the app, as performance difference is very great. There are some articles on how to compile Android app in release mode. This may also help with your Android deployment. https://blogs.oracle.com/shay/entry/speed_up_adf_mobile_deployment
    Thanks,
    Joe Huang

  • How to use GooglePlayServices libs in Native Extension of Android AIR app?

    I am trying to use some features of Google Play Services lib but I could not make it work. I have added the reference to the google play service libs to the manifest file (from Flash Builder)
    <application android:enabled="true">
    <meta-data  android:name="com.google.android.gms.version"
                    android:value="@integer/google_play_services_version" />
    <activity android:excludeFromRecents="false">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    </application>
    In my ANE, I have added the reference to the source of google-play-services_lib, but when I tried to call the FREFunction to check the availability of Google Play Service
    @Override
    public FREObject call(FREContext context, FREObject[] args){
         boolean result = false;
         try{
          Activity activitiy = context.getActivity();
          activityContext = activitiy.getBaseContext();
              result = isGooglePlayServiceExists();
         }catch(IllegalStateException e){
          Log.e(AneUtils.TAG, "Failed to get AIR current activity", e);
         FREObject obj = null;
        try{
            obj = FREObject.newObject(result);
        }catch(FREWrongThreadException e){
            Log.e(AneUtils.TAG, "Failed to create FREObject from [" + result + "]");
        return obj;
    private boolean isGooglePlayServiceExists(Context activityContext){
        int googlePlayServicesCheck = -1;
        try{
            googlePlayServicesCheck = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activityContext);
        }catch(Exception e){
            Log.e(AneUtils.TAG, "Error getting googlePlayService state",e);
        if(googlePlayServicesCheck == ConnectionResult.SUCCESS){
             return true;
        return false;
    The ANE crashed at the line GooglePlayServicesUtil.isGooglePlayServicesAvailable(activityContext) so I really doubted the Google Play Service libs was not added.
    Has anyone successfully imported the Google Play Serivce libs into Adobe AIR Android app?
    Any advice or help will be appreciated. Thank you.

    hey sshk5,
    I have managed to make it work. The solution is quite simple, i will explain the steps below
    1. Download the latest Android SDK from ADT (including the latest version of GooglePlay lib)
    2. Check the version number of Google Play lib ( for example 412312....) something and in your FlashBuilder project, make sure you use the  exact number like
    <meta-data  android:name="com.google.android.gms.version" android:value="412312" />
    3. Use tool to merge the googlelib jar file with your native extension before importing the native extension to FlashBuilder. If you do not want to use any other tool, you can use the AIR 4.0 which will allow you to use commandline to merge jars (and even dependency resources)
    Hope it helps

  • Android Air App using AdMob "NULL Object" Error?!?

    Hi,
    I am currently developing an app using adobe air flashbuilder and I have incorporated AdMob type html adverts into it. The Adverts do come up nicely however if I run the app in debug mode I get this error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at model::AdMob/createAd()[C:\Users\Jack\Documents\Dropbox\Projects\App\App Final\src\model\AdMob.as:37]
    The Ads do still work regardless of this however this is then affecting other elements within the app so I would like to get rid of the error that is happening. Below is my code in the "AdMob.as" file where I believe the issue to be occuring, can someone please help me with this?
    package model
        import flash.display.Stage;
        import flash.events.Event;
        import flash.events.LocationChangeEvent;
        import flash.events.MouseEvent;
        import flash.geom.Rectangle;
        import flash.media.StageWebView;
        import flash.net.URLRequest;
        import flash.net.navigateToURL;
        public class AdMob
            // setup variables
            private var _stageWebView:StageWebView;
            private var myAdvertURL:String = "http://www.test.co.uk/AdMob/test.html";
            //private var myAdvertURL:String;
            private var adWidth:Number=480;
            private var adHeight:Number=85;
            private var stage:Stage;
            public function AdMob(adURL:String,_stage:Stage)
                myAdvertURL=adURL;
                stage=_stage;
                createAd();
            public function createAd():void {
                // check that _stageWebView doersn't exist
                if (! _stageWebView) {
                    _stageWebView = new StageWebView () ;
                    // set the size of the html 'window'
                    _stageWebView.viewPort = new Rectangle(0,stage.stageHeight-adHeight, 800, adHeight);
                    //_stageWebView.viewPort = new Rectangle((stage.stageWidth-adWidth)/2,stage.stageHeight-adHeight,adWidth,adHeight);
                    // add a listener for when the content of the StageWebView changes
                    _stageWebView.addEventListener(LocationChangeEvent.LOCATION_CHANGE,onLocationChange);
                    //add a listener for when the ad is loaded
                    _stageWebView.addEventListener(Event.COMPLETE,onComplete);
                    // start loading the URL;
                    _stageWebView.loadURL(myAdvertURL);
                // show the ad by setting it's stage property;
                //showAd();
            public function destroyAd():void {
                // check that the instace of StageWebView exists
                if (_stageWebView) {
                    trace("removing advert");
                    // destroys the ad
                    _stageWebView.stage = null;
                    _stageWebView = null;
            public function toggleAd():void {
                trace("toggling advert",_stageWebView);
                // check that StageWebView instance exists
                if (_stageWebView) {
                    trace("_stageWebView.stage:"+_stageWebView.stage);
                    if (_stageWebView.stage == null) {
                        //show the ad by setting the stage parameter
                        _stageWebView.stage = stage;
                    } else {
                        // hide the ad by nulling the stage parameter
                        _stageWebView.stage = null;
                } else {
                    // ad StageWebView doesn't exist - show create it
                    createAd();
            public function onLocationChange(event:LocationChangeEvent):void {
                // check that it's not our ad URL loading
                if (_stageWebView.location != myAdvertURL) {
                    // destroy the ad as the user has kindly clicked on my ad
                    destroyAd();
                    // Launch a normal browser window with the captured  URL;
                    navigateToURL( new URLRequest( event.location ) );
            public function onComplete(event:Event):void{
                //add the ad when it is loaded. If not it will apear a white rectangle until the load is complete.
                showAd();
            public function updateAd(adURL:String=null):void{
                if (adURL!=null){
                    myAdvertURL = adURL;
                destroyAd();
                createAd();
            public function showAd():void{
                if (_stageWebView)
                    _stageWebView.stage = stage;
            public function hideAd():void{
                if (_stageWebView)
                    _stageWebView.stage = null;

    @zhenya1919 - since you're currently going through this, could you please open a new bug report on this over at https://bugbase.adobe.com?  When adding the bug, please include some sample code or a sample application so we can quickly test this out internally.  If you'd like to keep this private, feel free to email the attachment to me directly ([email protected]). 
    Once added, please post back with the URL so that others effected can add their comments and votes.
    Thanks,
    Chris

Maybe you are looking for