本檔案中的範例和範例僅適用於JEE環境上的AEM Forms 。
使用Assembler服務API (Web服務)分解PDF檔案:
包含專案檔案。
建立使用MTOM的Microsoft .NET專案。 設定服務參考時,請務必使用下列WSDL定義: http://localhost:8080/soap/services/AssemblerService?WSDL&lc_version=9.0.1
.
Replace localhost
搭配裝載AEM Forms之伺服器的IP位址。
建立PDF組合器使用者端。
建立 AssemblerServiceClient
物件(使用其預設建構函式)。
建立 AssemblerServiceClient.Endpoint.Address
物件,使用 System.ServiceModel.EndpointAddress
建構函式。 將指定WSDL的字串值傳遞至AEM Forms服務(例如, http://localhost:8080/soap/services/AssemblerService?blob=mtom
)。 您不需要使用 lc_version
屬性。 當您建立服務參考時,會使用此屬性。
建立 System.ServiceModel.BasicHttpBinding
物件,方法是取得 AssemblerServiceClient.Endpoint.Binding
欄位。 將傳回值轉換為 BasicHttpBinding
.
設定 System.ServiceModel.BasicHttpBinding
物件的 MessageEncoding
欄位至 WSMessageEncoding.Mtom
. 此值可確保使用MTOM。
執行下列工作來啟用基本HTTP驗證:
AssemblerServiceClient.ClientCredentials.UserName.UserName
.AssemblerServiceClient.ClientCredentials.UserName.Password
.HttpClientCredentialType.Basic
至欄位 BasicHttpBindingSecurity.Transport.ClientCredentialType
.BasicHttpSecurityMode.TransportCredentialOnly
至欄位 BasicHttpBindingSecurity.Security.Mode
.參考現有的DDX檔案。
BLOB
物件(使用其建構函式)。 此 BLOB
物件可用來儲存DDX檔案。System.IO.FileStream
物件(透過叫用其建構函式)。 傳遞字串值,代表DDX檔案的檔案位置以及開啟檔案的模式。System.IO.FileStream
物件。 您可以取得 System.IO.FileStream
物件的 Length
屬性。System.IO.FileStream
物件的 Read
方法,並傳遞位元組陣列、起始位置以及要讀取的資料流長度。BLOB
物件,透過指派其 MTOM
具有位元組陣列內容的屬性。參照PDF檔案以分解。
BLOB
物件(使用其建構函式)。 此 BLOB
物件是用來儲存輸入PDF檔案。 此 BLOB
物件傳遞至 invokeOneDocument
作為引數。System.IO.FileStream
物件,方法是叫用其建構函式,並傳遞代表輸入PDF檔案的檔案位置和開啟檔案的模式的字串值。System.IO.FileStream
物件。 您可以取得 System.IO.FileStream
物件的 Length
屬性。System.IO.FileStream
物件的 Read
方法,並傳遞位元組陣列、起始位置以及要讀取的資料流長度。BLOB
物件,透過指派其 MTOM
欄位位位元組陣列的內容。MyMapOf_xsd_string_To_xsd_anyType
物件。 此集合物件是用來儲存要拆解的PDF。MyMapOf_xsd_string_To_xsd_anyType_Item
物件。MyMapOf_xsd_string_To_xsd_anyType_Item
物件的 key
欄位。 此值必須與DDX檔案中指定的PDF來源元素的值相符。BLOB
將PDF檔案儲存至的物件 MyMapOf_xsd_string_To_xsd_anyType_Item
物件的 value
欄位。MyMapOf_xsd_string_To_xsd_anyType_Item
物件至 MyMapOf_xsd_string_To_xsd_anyType
物件。 叫用 MyMapOf_xsd_string_To_xsd_anyType
object
Add方法並傳遞
MyMapOf_xsd_string_To_xsd_anyType` 物件。設定執行階段選項。
AssemblerOptionSpec
物件,使用其建構函式來儲存執行階段選項。AssemblerOptionSpec
物件。 例如,若要指示Assembler服務在發生錯誤時繼續處理工作,請指派 false
至 AssemblerOptionSpec
物件的 failOnError
欄位。拆解PDF檔案。
叫用 AssemblerServiceClient
物件的 invokeDDX
方法並傳遞下列值:
BLOB
物件,代表拆解PDF檔案的DDX檔案MyMapOf_xsd_string_To_xsd_anyType
包含要拆解之PDF檔案的物件AssemblerOptionSpec
指定執行階段選項的物件此 invokeDDX
方法傳回 AssemblerResult
包含工作結果和發生之任何例外狀況的物件。
儲存已拆解的PDF檔案。
若要取得新建立的PDF檔案,請執行下列動作:
AssemblerResult
物件的 documents
欄位,即 Map
包含已拆解PDF檔案的物件。Map
物件以取得每個產生的檔案。 然後,轉換該陣列成員的 value
至 BLOB
.BLOB
物件的 MTOM
屬性。 這會傳回您可以寫出至PDF檔案的位元組陣列。另請參閱