2012-07-05 65 views
1

對於我目前的任務,我需要做使用的Adobe Creative套裝擴展Builder和Flash Builder中的Adobe InDesign中的延伸。我想這對於那些瞭解Extension Builder和InDesign API的人來說更是一個問題。以頁面的截圖在InDesign擴展生成器

此擴展的點是加載一些數據和一些數據發送到服務器。我需要製作一個頁面的截圖,然後以JPG格式發送給服務器。但是,沒有(或者至少我找不到任何)創建位圖的方法(將其轉換爲對象似乎是不可能的,因爲這些對象只是對象而不是DisplayObject)。

我設法悄悄導出頁面爲JPEG文件,現在我想加載它們,併發送,但是這將需要建立一個AIR應用程序來處理這一切,所以這將是一個有點笨重。

所以總結起來的問題,如何採取使用CS Ext.Builder在InDesign頁面上的所有元素的抓屏?

+0

也許你可以試試,如果這是Adobe Captivate中的一個選項。這是一個屏幕錄製程序,因爲它是Adobe的,所以它可能有這個擴展。但它在黑暗中雖然有點不足。 – poepje 2012-07-06 07:58:05

回答

1

出口到JPG有什麼問題?您可以選擇導出頁面或對象本身。

這是我在最近的一個項目中編寫的代碼片段。希望能幫助到你。

public static function getFilePath():String { 

var app:com.adobe.indesign.Application = InDesign.app; 
var sel:* = app.selection, oldResolution:Number, oldColorSpace:JpegColorSpaceEnum, groupItems:Array = [], i:int = 0, n:int = sel.length; 

if (!sel || !n) 
     { 
      Alert.show("Pas de selection !", "title", Alert.OK, Sprite(mx.core.Application.application)); 
      return ""; 
     } 

     for (i = 0 ; i < n ; i ++) 
     { 
      groupItems [ groupItems.length ] = sel[i]; 
     } 
     sel = (sel.length > 1)? app.activeDocument.groups.add (sel) : sel[0] ; 

     var tempFolder:File = File.createTempDirectory(); 
     AppModel.getInstance().jpgFolder = tempFolder; 
     var jpgFile:File = new File(); 
     jpgFile.nativePath = tempFolder.nativePath + "/temp.jpg"; 

     oldResolution = app.jpegExportPreferences.exportResolution; 
     app.jpegExportPreferences.exportResolution = 72; 
     oldColorSpace = app.jpegExportPreferences.jpegColorSpace; 
     app.jpegExportPreferences.jpegColorSpace = JpegColorSpaceEnum.GRAY; 
     sel.exportFile (ExportFormat.jpg, jpgFile); 


     app.jpegExportPreferences.jpegColorSpace = oldColorSpace; 
     app.jpegExportPreferences.exportResolution = oldResolution; 

     if (sel is Group) 
     { 
      sel.ungroup(); 
      app.select (groupItems); 
     } 

     return jpgFile.nativePath; 
    } 
+0

指着我在正確的方向=) – 2012-07-09 22:10:56