Adobe AIRアプリケーション中にPDFをプレビューする | DigiTechLog Dot Com

来源:百度文库 编辑:神马文学网 时间:2024/04/29 17:27:00

1、プレビューウィンドウを作るため、CPDFPreviewのインスタンスを生成とする

  1. var aPreview:CPDFPreview = new CPDFPreview();
  2. aPreview.open( true );

2、loadFile()でPDFファイルの参照を渡す

  1. aPreview.loadFile( fp );

もしくは下記のようなファイルURL形式で渡す

  1. aPreview.loadFile( “file://” + fp.nativePath  );

3、下記のサンプルソースコード

  1.     creationComplete=”init();”
  2.     >
  3.    
  4.    
  5.        
  6.             private const  DEFAULT_TITLE:String    = "PDF Preview";
  7.             private function init():void {
  8.             }
  9.             public function loadURL( anURL:String = "http://your.url.default/", showStatusLocation:Boolean = false ):void {
  10.                 title = DEFAULT_TITLE;
  11.                 if ( true == showStatusLocation ) {
  12.                     status = ' Preview of: ' + anURL;
  13.                 }
  14.                 htMainView.location = anURL;
  15.             }
  16.             public function loadFile( anURL:File, showStatusLocation:Boolean = false  ):void {
  17.                 if ( null != anURL ) {
  18.                     loadURL( "file://" + anURL.nativePath, showStatusLocation );
  19.                 }
  20.             }
  21.         ]]>
  22.