Skip to main content
Participant
June 25, 2012
Question

How to open a native PDF file in Android using AIR?

  • June 25, 2012
  • 1 reply
  • 8300 views

Hello.I have created a flex mobile project to open and show a native PDF file in Android. I have tried three different methods below , but  I failed.

1. I created a stagewebview and used "stageWebView.loadURL". I can see the PDF View in emulator but it didn't work in Android Pad (SAMSUNG Galaxy Tab 10.1). It showed blank screen.

Note that I have installed AIR 3.3.

stageWebView1.loadURL(new File(new File("app:/assets/ZUGH-2P.pdf").nativePath).url);

2. I created a stagewebview and used stagewebview to load javascript. The javascript could run in emulator, but it didn't work in Android Pad. I failed again.

stageWebView1.loadURL(new File(new File("app:/assets/JavaScripthtml.html").nativePath).url);

3.  I imported stagewebviewbridge, which is the extended version of stagewebviewbridge. I created a stagewebviewbridge , but it could not run in emulator. I failed again.

stageWebViewbridge1.loadLocalURL( "appfile:/assets/pdf.html");

could any one give me some suggestions? Many thanks.

This topic has been closed for replies.

1 reply

Inspiring
June 25, 2012

I don't think Android supports that functionality.

Try opening any PDF on the web with the browser on an Android device, it will download the PDF instead of displaying it.

jrunrandy
Adobe Employee
Adobe Employee
June 26, 2012

I think that @PierreSolutions is correct. Does your app exhibit that behavior (that is, does it download the PDF?) when running on the device?

Regards,

Randy Nielsen

Senior Content and Community Manager

Adobe Systems Incorporated

Participant
June 27, 2012

Dear jrunrandy,

I have work on this problem for a long time.But I was unable to

solve it. How can I open a native PDF file? The browser showed that

file path was incorrect. How can I  form the right file path?My

codes are below.

navigateToURL(new URLRequest("app:/assets/ZUGH-2P.pdf"),"_blank");

It worked very well in emulator, but failed in Android Pad.

I noticed that you are an employee of  Adobe company.

Could you please give me some suggestion in detail? Thank you very

much.