Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / LiveCycle Developer Center /

Compressing and decompressing files using a LiveCycle ES2 custom DSC

by Nithiyanandam Dharmadass

Nithiyanandam Dharmadass
  • nith-lces.blogspot.com

Content

  • Creating a custom DSC component
  • Creating a Component.XML file
  • Packaging and deploying the component
  • Using the ZIP service in workflows
  • Some business use cases
  • Where to go from here

Created

10 October 2011

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
componentscustomizationdeploymentLiveCycle Designer ES4workflow
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisite knowledge

Experience with Adobe LiveCycle Process Management ES2 (version 9.0), basic Java programming, and creating custom Component for Adobe LiveCycle ES2 (version 9.0)

 

Additional required other products

  • Java editor such as Eclipse or Netbeans IDE

User level

Intermediate

Required products

  • LiveCycle Designer ES4 (Download trial)

Sample files

  • custom-dsc-source.zip

Adobe LiveCycle ES2 enables developers to create custom DSC (Document Service Container) to create enriched out of the box features. Creating such components are pluggable to the LiveCycle runtime environment and serves the intended purpose. This article explains how to create a custom ZIP Service which can be used to compress a list of files into a .zip file and decompress a .zip to a list of documents.

Creating a custom DSC component

Create a custom DSC component with two service operations to compress and decompress list of documents. This component uses java.util.zip package for compression and decompression. Follow the below steps to create a custom component:

  1. Add the adobe-livecycle-client.jar file to the library
  2. Add the required Icons
  3. Create a public class
  4. Create two public methods named UnzipDocument & ZipDocuments
  5. Write the logic for Compression & Decompression

The code can be found here:

/* * Custom DSC : ZIP Utility * Purpose: This is a LiveCycle ES2 custom component used to Compress & Decompress List of Documents * Author: Nithiyanandam Dharmadass * Organization: Ministry of Finance, Kingdom of Bahrain * Last modified Date: 18/Apr/2011 */ package nith.lces2.dsc; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import com.adobe.idp.Document; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.zip.ZipOutputStream; public class ZIPService { static final int BUFFER = 2048; // 2MB buffer size public java.util.List UnzipDocument(com.adobe.idp.Document zipDocument) throws Exception { ZipInputStream zis = new ZipInputStream(zipDocument.getInputStream()); ZipEntry zipFile; List resultList = new ArrayList(); while ((zipFile = zis.getNextEntry()) != null) { ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream(); int count; // an int variable to hold the number of bytes read from input stream byte data[] = new byte[BUFFER]; while ((count = zis.read(data, 0, BUFFER)) != -1) { byteArrayOutStream.write(data, 0, count); // write to byte array } com.adobe.idp.Document unzippedDoc = new Document(byteArrayOutStream.toByteArray()); // create an idp document unzippedDoc.setAttribute("file", zipFile.getName()); unzippedDoc.setAttribute("wsfilename", zipFile.getName()); // update the wsfilename attribute resultList.add(unzippedDoc); } return resultList; // List of uncompressed documents } public com.adobe.idp.Document ZipDocuments(java.util.List listOfDocuments,java.lang.String zipFileName) throws Exception { if (listOfDocuments == null || listOfDocuments.size() == 0) { return null; } ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(byteArrayOutStream); // ZIP Output Stream for (int i = 0; i < listOfDocuments.size(); i++) { Document doc = (Document) listOfDocuments.get(i); InputStream docInputStream = doc.getInputStream(); ZipEntry zipEntry = new ZipEntry(doc.getAttribute("file").toString()); zos.putNextEntry(zipEntry); int count; byte data[] = new byte[BUFFER]; while ((count = docInputStream.read(data, 0, BUFFER)) != -1) { zos.write(data, 0, count); // Read document content and add to zip entry } zos.closeEntry(); } zos.flush(); zos.close(); Document zippedDoc = new Document(byteArrayOutStream.toByteArray()); if(zipFileName==null || zipFileName.equals("")) { zipFileName = "CompressedList.zip"; } zippedDoc.setAttribute("file", zipFileName); return zippedDoc; } }

Creating a Component.XML file

A component.xml file must be created within the root folder of the package which defined the service operations and their parameters.

The component.xml file is shown here:

<?xml version="1.0" encoding="UTF-8"?> <component xmlns="http://adobe.com/idp/dsc/component/document"> <!-- Unique id identifying this component --> <component-id>ZipService</component-id> <!-- Version --> <version>1.0</version> <!-- Start of the Service definition --> <services> <!-- Unique name for service descriptor. The value is used as the default name for deployed services --> <service name="ZipService"> <!-- service implementation class definition --> <implementation-class>nith.lces2.dsc.ZIPService</implementation-class> <!-- description --> <description>Compress or Decompress list of documents</description> <!-- You can provide your own icons for a distinct look --> <small-icon>icons/Zip_icon16.png</small-icon> <large-icon>icons/Zip_icon32.png</large-icon> <!-- automatically deploys the service and starts it after installation --> <auto-deploy service-id="ZipService" /> <operations> <!-- method name in the interface setSmtpHost--> <operation name="UnzipDocument"> <!-- input parameters to the "send" method --> <input-parameter name="zipDocument" title="Input ZIP Document" type="com.adobe.idp.Document"> <hint>A ZIP File to be decompressed</hint> </input-parameter> <output-parameter name="resultList" title="Decompressed list of documents" type="java.util.List"> <hint>Decompressed ZIP list</hint> </output-parameter> </operation> <operation name="ZipDocuments"> <!-- input parameters to the "send" method --> <input-parameter name="listOfDocuments" title="List of Documents" type="java.util.List"> <hint>A list of documents to be Compressed</hint> </input-parameter> <input-parameter name="zipFileName" title="Result File Name" type="java.lang.String"> <hint>The name of compressed file (optional)</hint> </input-parameter> <output-parameter name="zippedDoc" title="Compressed Zip file" type="com.adobe.idp.Document"> <hint>Compressed ZIP File</hint> </output-parameter> </operation> </operations> </service> </services> </component>

Packaging and deploying the component

  1. Compile the java project and create a .JAR file
  2. Deploy the component (.JAR file) to the LiveCycle runtime through Workbench ES2
  3. Start the service from Workbench ES2 (see Figuure 1).
Figure 1. Installed ZipService in components panel
Figure 1. Installed ZipService in components panel

Using the ZIP service in workflows

The UnzipDocument operation of the custom service can now accept a document variable as input and return a list of document variables as output (see Figure 3).

Similarly the ZipDocuments operation of the custom component can accept a list of documents as input, compress them as a zip file and return the compressed document (see Figure 4).

The following workflow orchestration shows how to decompress the given ZIP file, compress them back to another ZIP file, and returns output (see Figure 2).

Figure 2. ZipService used in process design
Figure 2. ZipService used in process design
Figure 3. UnzipDocument operation props
Figure 3. UnzipDocument operation props
Figure 4. ZipDocuments operation props
Figure 4. ZipDocuments operation props

Some business use cases

You can use this ZIP Service for the following use cases:

  • Find all files in a given folder and return the files as a compressed document.
  • Supply a ZIP file containing a number of PDF documents which can be reader extended after decompressing them. This requires LiveCycle Reader Extensions module.
  • Supply a ZIP file containing heterogeneous type of document which can be decompressed and converted as PDF document using Generate PDF service.
  • Policy protect a list of documents and return as a ZIP file
  • Allow users to download all the attachments of a process instance as a single ZIP file

Where to go from here

You can extend the service to compress and decompress files into GZIP document format.

You can find the documentation for creating custom components here and the ZIP package reference here.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

More Like This

  • Creating enterprise database components
  • Customizing form guides
  • Extending LiveCycle ES software through custom DSC development – Part 1: Create a basic service component
  • Adding navigation tabs to Adobe LiveCycle Workspace ES2
  • Introduction to typography enhancements in LiveCycle Designer ES Update 1
  • Invoking web services using custom components
  • Displaying a list of participants for a review stage in e-mail for Managed Review & Approval Solution Accelerator 9.5
  • Adding SMS, fax, e-mail, and voice notifications to LiveCycle ES processes

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement