open and display a pdf file using actionscript for mobiles (iOS)

强颜欢笑 提交于 2019-12-12 09:18:22

问题


Currently I am working with Adobe AIR and getting practice with ActionScript. My aim is to display a PDF file in a view (iPad view in specific). To do so, I was using URLRequest to specify the location of the PDF and HTMLLoader for load the PDF. However is not working, I read in the documentation the following:

HTMLLoader class. AIR profile support: This feature is supported on all desktop operating systems, but is not supported on mobile devices or on AIR for TV devices.

For this reason I would like to ask you folks if you have done something similar, or do you know a workaround for it?

Thanks in advance!


回答1:


I think StageWebView is what you need.

I've just done a similar thing like this...

var _file:String = "nameOfPdf.pdf";
var webView = new StageWebView();
webView.stage = stage;
webView.viewPort = new Rectangle(20,103,960,640);//specify the clipping mask(x,y,w,h)

//NB I have my pdf file as an included file here (added in the publish panel.
var fPath:String = new File(new File("app:/includes/"+_file).nativePath).url;
webView.loadURL( fPath );

//Alternatively you should be able to navigate to a URL
webView.loadURL("http://www.google.com");



回答2:


There's an external tool called pdf2swf that will transform a pdf into a working swf that you can add just as any other swf. If all you want is a fixed pdf, you can transform it previously and load the transformed swf directly. But if you want any pdf, you would need a external web server to perform the transformation step.



来源:https://stackoverflow.com/questions/8248699/open-and-display-a-pdf-file-using-actionscript-for-mobiles-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!