de.maas.afp2web
Class A2WSDK

java.lang.Object
  extended by de.maas.afp2web.A2WSDK

public class A2WSDK
extends java.lang.Object

A native wrapper for AFP2web SDK. AFP2web SDK provides interfaces to convert AFP, TIFF and Line Data spools into web applicable output formats like PDF, JPEG, TIFF etc. Please visit: http://www.oxseed.com to get more information


Method Summary
 int afp2web(java.util.Properties propConfigPar, java.io.ByteArrayInputStream baisInputStreamPar, java.io.ByteArrayOutputStream baosOutputStreamPar)
           Converts 1 input spool (passed as stream) to 1 output document (passed as stream).
 int afp2web(java.util.Properties propConfigPar, java.io.InputStream[] arrInputStreamPar, java.io.InputStream[] arrResourceStreamPar, java.io.InputStream[] arrDocIndexStreamPar, java.io.InputStream[] arrFormDefStreamPar)
           Converts one or N AFP input streams to 1 or N output files based on "FileCreationMode" parameter.
 int afp2web(java.util.Properties propConfigPar, java.io.InputStream[] arrInputStreamPar, java.io.InputStream[] arrResourceStreamPar, java.io.InputStream[] arrDocIndexStreamPar, java.io.InputStream[] arrFormDefStreamPar, A2WDocumentHandler a2wDocumentHandlerPar)
           Converts one or N AFP input streams to 1 or N output documents based on "FileCreationMode" parameter.
 int afp2web(java.util.Properties propConfigPar, java.io.InputStream[] arrInputStreamPar, java.io.InputStream[] arrResourceStreamPar, java.io.InputStream[] arrDocIndexStreamPar, java.io.InputStream[] arrFormDefStreamPar, A2WDocumentWriter a2wDocumentWriterPar)
           Converts one or N AFP input streams to 1 or N output documents based on "FileCreationMode" parameter.
 int afp2web(java.util.Properties propConfigPar, java.lang.String[] sarrFileNameListPar)
           Converts 1 to N input spools (passed as filename list) to 1 to N output files.
 int afp2web(java.util.Properties propConfigPar, java.lang.String[] sarrFileNameListPar, A2WDocumentHandler a2wDocumentHandlerPar)
           Converts 1 to N input spools (passed as filename list) to 1 to N output buffers.
 int afp2web(java.util.Properties propConfigPar, java.lang.String[] sDocumentIdsPar, A2WDocumentReader a2wDocReaderPar, java.io.ByteArrayOutputStream baosOutputStreamPar)
           Converts N input documents to 1 output buffer, Input document will be retrieved using A2WDocumentReader callback implementation by passing in the document id given as parameter to this API, A2WDocumentReader's "read" function is called for each input document id.
 int afp2web(java.util.Properties propConfigPar, java.lang.String[] sDocumentIdsPar, A2WDocumentReader a2wDocReaderPar, java.lang.String sOutputFilenamePar)
           Converts N input documents to 1 output file, Input document will be retrieved using A2WDocumentReader callback implementation by passing in the document id given as parameter to this API, A2WDocumentReader's "read" function is called for each input document id.
 int afp2web(java.util.Properties propConfigPar, java.lang.String[] sarrFileNameListPar, A2WDocumentWriter a2wDocumentWriterPar)
           Converts 1 to N input spools (passed as filename list) to 1 to N output buffers.
 int afp2web(java.util.Properties propConfigPar, java.lang.String[] sarrFileNameListPar, java.io.ByteArrayOutputStream baosOutputStreamPar)
           Converts N input spools (passed as filename list) to 1 output document (passed as stream).
 int createCredit(java.util.Properties propConfigPar, java.lang.String sCreditFilePathPar)
           Creates the Credit file and UCID file
 int displayCredit(java.util.Properties propConfigPar, java.lang.String sCreditFilePathPar)
           Used to display the available credit
 int exportCredit(java.util.Properties propConfigPar, java.lang.String sUCIDFilenamePar)
           Used to move AFP2web installation from one location to another location
 java.lang.String getActiveSpoolname()
          Get active spool name
static A2WSDK getSingleton()
          Returns singleton instance of A2WSDK class, which has to be used to call other methods of A2WSDK class.
 java.lang.String getUniqueSystemId()
          Get Unique System Id
 java.lang.String getUniqueSystemId(java.util.Properties propConfigPar)
           Generates Unique System Id (USID)
 java.lang.String getVersion()
          Get version string of AFP2web SDK
 java.lang.String getVersionAll()
          Get version of all sub components string of AFP2web SDK
 int importCredit(java.util.Properties propConfigPar, java.lang.String sVoucherFilenamePar)
           Import the credit from voucher file to credit file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSingleton

public static A2WSDK getSingleton()
Returns singleton instance of A2WSDK class, which has to be used to call other methods of A2WSDK class.

Returns:
Singleton instance of A2WSDK class

Example:
A2WSDK a2wsdkThe = A2WSDK.getSingleton();


getActiveSpoolname

public java.lang.String getActiveSpoolname()
Get active spool name

Returns:
Active spool name that has been under conversion process. Usefull to generate output filename in document handler callback.

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.io.ByteArrayInputStream baisInputStreamPar,
                   java.io.ByteArrayOutputStream baosOutputStreamPar)
            throws A2WException

Converts 1 input spool (passed as stream) to 1 output document (passed as stream). Output format is specified in properties parameter.

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters
baisInputStreamPar - Stream containing input spool data buffer of type java.io.ByteArrayInputStream
baosOutputStreamPar - Stream to receive output document buffer of type java.io.ByteArrayOutputStream

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error
 
Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      baisInputStreamTmp,
                                      baosOutputStreamTmp );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.

 Parameter "baosOutputStreamPar" should contain valid ByteArrayOutputStream instance
 
Synopsis:
 try {

       String strFileNameTmp = "samples\insure.afp";

       // Read input  file and copy it to Byte Array
       byte [] byarrInputTmp ;
         ...
         ...
       // Create Input Stream and fill with input data
       ByteArrayInputStream baisAFPBufferTmp = new ByteArrayInputStream( byarrInputTmp );

       // Allocate stream to hold Output buffer
       ByteArrayOutputStream baosPDFBufferTmp = new ByteArrayOutputStream();

       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
       propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
       propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
         ...
          ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Call conversion process of AFP2web SDK
       a2wsdkThe.afp2web( propConfigTmp,
                          baisAFPBufferTmp,
                          baosPDFBufferTmp );

       // process output buffer
         ...
         ...

   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[ConvertAFP2PDF] Error! Unable to convert spool: " +
                            strFileNameTmp +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 Above sample program will receive converted PDF output buffer on "baosPDFBufferTmp" variable.

 Also refer to the ConvertAFP2PDF.java sample provided with the AFP2web Java SDK.
 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.lang.String[] sarrFileNameListPar,
                   java.io.ByteArrayOutputStream baosOutputStreamPar)
            throws A2WException

Converts N input spools (passed as filename list) to 1 output document (passed as stream). Output format is specified in properties parameter.

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters of type
sarrFileNameListPar - String Array containing list of filenames
baosOutputStreamPar - Stream to receive output document buffer of type java.io.ByteArrayOutputStream

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error
 
Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      sarrFileNameListTmp,
                                      baosOutputStreamTmp );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 When "TIFFIN" is set as "INPUTFORMAT", "DOC_MERGE" is the only
 "FILECREATIONMODE" allowed in this method. This restriction will
 be removed in future versions.

 For further details, please refer to AFP2web's User Guide and Reference.

 Parameter "baosOutputStreamPar" should contain valid ByteArrayOutputStream instance
 
Synopsis:
 try {

       //Get List of file names and store them in String Array
       String[] sarrFileNameListTmp ;
       sarrFileNameListTmp[0]="samples\Doc1.tif";
       sarrFileNameListTmp[1]="samples\Doc2.tif";
       ...
       ...
       // Allocate stream to hold Output buffer
       ByteArrayOutputStream baosPDFBufferTmp = new ByteArrayOutputStream();

       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
       propConfigTmp.setProperty( A2WIniConstants.INPUTFORMAT, "TIFFIN" );
       propConfigTmp.setProperty( A2WIniConstants.FILECREATIONMODE, "DOC_MERGE");
       propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
       propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
       ...
       ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Call conversion process of AFP2web SDK
       a2wsdkThe.afp2web( propConfigTmp,
                            sarrFileNameListTmp,
                             baosPDFBufferTmp );

       // process output buffer
       ...
       ...

   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[ConvertTIFF2PDF] Error! Conversion failed." +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 Above sample program will receive converted PDF output buffer on "baosPDFBufferTmp" variable
 which has "Doc1.tif" and "Doc2.tif" merged together.

 Also refer to the ConvertAFP2PDF.java sample provided with the AFP2web Java SDK.
 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.lang.String[] sarrFileNameListPar)
            throws A2WException

Converts 1 to N input spools (passed as filename list) to 1 to N output files. Output format is specified in properties parameter. Setting "MemoryOuptutStream" ini attribute is immaterial to this API.

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters
sarrFileNameListPar - String Array containing list of filenames

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error

 
Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      sarrFileNameListTmp );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.

 
Synopsis:
 try {

       //Get List of file names and store them in String Array
       String[] sarrFileNameListTmp ;
       sarrFileNameListTmp[0]="samples\Doc1.afp" ;
       sarrFileNameListTmp[1]="samples\Doc2.afp" ;
       ...
       ...
       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
       propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
       propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
       ...
       ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Call conversion process of AFP2web SDK
       a2wsdkThe.afp2web( propConfigTmp,
                            sarrFileNameListTmp );
       ...
       ...
   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[ConvertAFP2web] Error! Conversion failed." +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 Above sample program will generate "Doc1.pdf" and "Doc2.pdf" on output path (pdf/)

 Also refer to the AFP2web.java sample provided with the AFP2web Java SDK
 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.lang.String[] sarrFileNameListPar,
                   A2WDocumentHandler a2wDocumentHandlerPar)
            throws A2WException

Converts 1 to N input spools (passed as filename list) to 1 to N output buffers. Output format is specified in properties parameter. Document handler's "handle" function is called for each output document with document buffer and index(es) passed as parameters Setting "MemoryOuptutStream" ini attribute is immaterial to this API.

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters
sarrFileNameListPar - String Array containing list of filenames
a2wDocumentHandlerPar - A2WDocumentHandler

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error

 
Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      sarrFileNameListTmp,
                                      a2wDocumentHandlerTmp );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.
 
Synopsis:
 try {

       //Get List of file names and store them in String Array
       String[] sarrFileNameListTmp ;
       sarrFileNameListTmp[0]="samples\Doc1.afp" ;
       sarrFileNameListTmp[1]="samples\Doc2.afp" ;
       ...
       ...
       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
       propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
       propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
       ...
       ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Create A2WDocumentHandler
       CustomDocumentHandler a2wDocHandlerTmp = new CustomDocumentHandler();

       // Call conversion process of AFP2web SDK
       a2wsdkThe.afp2web( propConfigTmp,
                          sarrFileNameListTmp,
                          a2wDocHandlerTmp );
       ...
       ...
   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[ConvertAFP2web] Error! Conversion failed." +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 Above sample program will generate "Doc1.pdf" and "Doc2.pdf" on output path (pdf/)

 Also refer to the AFP2webMem.java sample provided with the AFP2web Java SDK
 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.lang.String[] sarrFileNameListPar,
                   A2WDocumentWriter a2wDocumentWriterPar)
            throws A2WException

Converts 1 to N input spools (passed as filename list) to 1 to N output buffers. Output format is specified in properties parameter. Document writer's "write" function is called for each output document with document buffer, index(es) and user data list passed as parameters Setting "MemoryOuptutStream" ini attribute is immaterial to this API.

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters
sarrFileNameListPar - String Array containing list of filenames
a2wDocumentWriterPar - A2WDocumentWriter

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error

 
Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      sarrFileNameListTmp,
                                      a2wDocumentWriterTmp );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.
 
Synopsis:
 try {

       //Get List of file names and store them in String Array
       String[] sarrFileNameListTmp ;
       sarrFileNameListTmp[0]="samples\Doc1.afp" ;
       sarrFileNameListTmp[1]="samples\Doc2.afp" ;
       ...
       ...
       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
       propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
       propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
       ...
       ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Create A2WDocumentWriter
       CustomDocumentWriter a2wDocWriterTmp = new CustomDocumentWriter();

       // Call conversion process of AFP2web SDK
       a2wsdkThe.afp2web( propConfigTmp,
                          sarrFileNameListTmp,
                          a2wDocWriterTmp );
       ...
       ...
   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[ConvertAFP2web] Error! Conversion failed." +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 Above sample program will generate "Doc1.pdf" and "Doc2.pdf" on output path (pdf/)

 Also refer to the AFP2webMem.java sample provided with the AFP2web Java SDK
 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.io.InputStream[] arrInputStreamPar,
                   java.io.InputStream[] arrResourceStreamPar,
                   java.io.InputStream[] arrDocIndexStreamPar,
                   java.io.InputStream[] arrFormDefStreamPar)
            throws A2WException

Converts one or N AFP input streams to 1 or N output files based on "FileCreationMode" parameter. "FileCreationMode" and "OutputFormat" are specified in properties parameter. Setting "MemoryOuptutStream" ini attribute is immaterial to this API AFP Input Stream given at "N"th index in "arrInputStreamPar" uses resource, document index and formdef streams given at "N"th index of "arrResourceStreamPar", "arrDocIndexStreamPar", "arrFormDefStreamPar" arrays respectively.

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters
arrInputStreamPar - Array of AFP input streams
arrResourceStreamPar - Array of AFP resource streams
arrDocIndexStreamPar - Array of AFP Document index streams
arrFormDefStreamPar - Array of AFP Form Def streams

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error

 
Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      arrInputStreamTmp,
                                      arrResourceStreamTmp,
                                      arrDocIndexStreamTmp,
                                      arrFormDefStreamTmp
                                    );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.

 
Synopsis:
 try {

       // Create Java input streams for Spool, Resource, Document Index and FormDef files
       int iFileCountTmp = 2 ;
       java.io.FileInputStream[] arrInputStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrResourceStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrDocIndexStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrFormDefStreamTmp = new java.io.FileInputStream[iFileCountTmp];

       arrInputStreamTmp[0]    = new java.io.FileInputStream("samples\Doc1.afp" );
       arrResourceStreamTmp[0]= new java.io.FileInputStream("samples\Doc1.res" );
       arrDocIndexStreamTmp[0]= new java.io.FileInputStream("samples\Doc1.idx" );
       arrFormDefStreamTmp[0]    = new java.io.FileInputStream("samples\Doc1.fde" );

       arrInputStreamTmp[1]    = new java.io.FileInputStream("samples\Doc2.afp" );
       arrResourceStreamTmp[1]= new java.io.FileInputStream("samples\Doc2.res" );
       arrDocIndexStreamTmp[1]= new java.io.FileInputStream("samples\Doc2.idx" );
       arrFormDefStreamTmp[1]    = new java.io.FileInputStream("samples\Doc2.fde" );
       ...
       ...
       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
       propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
       propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
       ...
       ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Call conversion process of AFP2web SDK
       a2wsdkThe.afp2web( propConfigTmp,
                          arrInputStreamTmp,
                          arrResourceStreamTmp,
                          arrDocIndexStreamTmp,
                          arrFormDefStreamTmp
                        );
       ...
       ...
   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[ConvertAFP2web] Error! Conversion failed." +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 Above sample program will generate "Doc1.pdf" and "Doc2.pdf" on output path (pdf/)

 Also refer to the AFP2webFileStream.java sample provided with the AFP2web Java SDK
 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.io.InputStream[] arrInputStreamPar,
                   java.io.InputStream[] arrResourceStreamPar,
                   java.io.InputStream[] arrDocIndexStreamPar,
                   java.io.InputStream[] arrFormDefStreamPar,
                   A2WDocumentHandler a2wDocumentHandlerPar)
            throws A2WException

Converts one or N AFP input streams to 1 or N output documents based on "FileCreationMode" parameter. "FileCreationMode" and "OutputFormat" are specified in properties parameter. Setting "MemoryOuptutStream" ini attribute is immaterial to this API Document handler's "handle" function is called for each output document with document buffer and index(es) passed as parameters AFP Input Stream given at "N"th index in "arrInputStreamPar" uses resource, document index and formdef streams given at "N"th index of "arrResourceStreamPar", "arrDocIndexStreamPar", "arrFormDefStreamPar" arrays respectively.

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters
arrInputStreamPar - Array of AFP input streams
arrResourceStreamPar - Array of AFP resource streams
arrDocIndexStreamPar - Array of AFP Document index streams
arrFormDefStreamPar - Array of AFP Form Def streams
a2wDocumentHandlerPar - A2WDocumentHandler

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error

 
Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      arrInputStreamTmp,
                                      arrResourceStreamTmp,
                                      arrDocIndexStreamTmp,
                                      arrFormDefStreamTmp,
                                      a2wDocumentHandlerTmp
                                    );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.

 
Synopsis:
 try {

       // Create Java input streams for Spool, Resource, Document Index and FormDef files
       int iFileCountTmp = 2 ;
       java.io.FileInputStream[] arrInputStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrResourceStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrDocIndexStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrFormDefStreamTmp = new java.io.FileInputStream[iFileCountTmp];

       arrInputStreamTmp[0]    = new java.io.FileInputStream("samples\Doc1.afp" );
       arrResourceStreamTmp[0]= new java.io.FileInputStream("samples\Doc1.res" );
       arrDocIndexStreamTmp[0]= new java.io.FileInputStream("samples\Doc1.idx" );
       arrFormDefStreamTmp[0]    = new java.io.FileInputStream("samples\Doc1.fde" );

       arrInputStreamTmp[1]    = new java.io.FileInputStream("samples\Doc2.afp" );
       arrResourceStreamTmp[1]= new java.io.FileInputStream("samples\Doc2.res" );
       arrDocIndexStreamTmp[1]= new java.io.FileInputStream("samples\Doc2.idx" );
       arrFormDefStreamTmp[1]    = new java.io.FileInputStream("samples\Doc2.fde" );
       ...
       ...
       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
       propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
       propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
       ...
       ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Create A2WDocumentHanlder
       CustomDocumentHandler a2wDocHandlerTmp = new CustomDocumentHandler();

       // Call conversion process of AFP2web SDK
       a2wsdkThe.afp2web( propConfigTmp,
                          arrInputStreamTmp,
                          arrResourceStreamTmp,
                          arrDocIndexStreamTmp,
                          arrFormDefStreamTmp,
                          a2wDocHandlerTmp
                        );
       ...
       ...
   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[ConvertAFP2web] Error! Conversion failed." +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 Above sample program will generate "Doc1.pdf" and "Doc2.pdf" on output path (pdf/)

 Also refer to the AFP2webFileStream.java sample provided with the AFP2web Java SDK
 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.io.InputStream[] arrInputStreamPar,
                   java.io.InputStream[] arrResourceStreamPar,
                   java.io.InputStream[] arrDocIndexStreamPar,
                   java.io.InputStream[] arrFormDefStreamPar,
                   A2WDocumentWriter a2wDocumentWriterPar)
            throws A2WException

Converts one or N AFP input streams to 1 or N output documents based on "FileCreationMode" parameter. "FileCreationMode" and "OutputFormat" are specified in properties parameter. Setting "MemoryOuptutStream" ini attribute is immaterial to this API Document writer's "write" function is called for each output document with document buffer, index(es) and user data list passed as parameters AFP Input Stream given at "N"th index in "arrInputStreamPar" uses resource, document index and formdef streams given at "N"th index of "arrResourceStreamPar", "arrDocIndexStreamPar", "arrFormDefStreamPar" arrays respectively.

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters
arrInputStreamPar - Array of AFP input streams
arrResourceStreamPar - Array of AFP resource streams
arrDocIndexStreamPar - Array of AFP Document index streams
arrFormDefStreamPar - Array of AFP Form Def streams
a2wDocumentWriterPar - A2WDocumentWriter

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error

 
Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      arrInputStreamTmp,
                                      arrResourceStreamTmp,
                                      arrDocIndexStreamTmp,
                                      arrFormDefStreamTmp,
                                      a2wDocumentWriterTmp
                                    );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.

 
Synopsis:
 try {

       // Create Java input streams for Spool, Resource, Document Index and FormDef files
       int iFileCountTmp = 2 ;
       java.io.FileInputStream[] arrInputStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrResourceStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrDocIndexStreamTmp = new java.io.FileInputStream[iFileCountTmp];
       java.io.FileInputStream[] arrFormDefStreamTmp = new java.io.FileInputStream[iFileCountTmp];

       arrInputStreamTmp[0]    = new java.io.FileInputStream("samples\Doc1.afp" );
       arrResourceStreamTmp[0]= new java.io.FileInputStream("samples\Doc1.res" );
       arrDocIndexStreamTmp[0]= new java.io.FileInputStream("samples\Doc1.idx" );
       arrFormDefStreamTmp[0]    = new java.io.FileInputStream("samples\Doc1.fde" );

       arrInputStreamTmp[1]    = new java.io.FileInputStream("samples\Doc2.afp" );
       arrResourceStreamTmp[1]= new java.io.FileInputStream("samples\Doc2.res" );
       arrDocIndexStreamTmp[1]= new java.io.FileInputStream("samples\Doc2.idx" );
       arrFormDefStreamTmp[1]    = new java.io.FileInputStream("samples\Doc2.fde" );
       ...
       ...
       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
       propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
       propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
       ...
       ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Create A2WDocumentWriter
       CustomDocumentWriter a2wDocWriterTmp = new CustomDocumentWriter();

       // Call conversion process of AFP2web SDK
       a2wsdkThe.afp2web( propConfigTmp,
                          arrInputStreamTmp,
                          arrResourceStreamTmp,
                          arrDocIndexStreamTmp,
                          arrFormDefStreamTmp,
                          a2wDocWriterTmp
                        );
       ...
       ...
   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[ConvertAFP2web] Error! Conversion failed." +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 Above sample program will generate "Doc1.pdf" and "Doc2.pdf" on output path (pdf/)

 Also refer to the AFP2webFileStream.java sample provided with the AFP2web Java SDK
 

Throws:
A2WException

getUniqueSystemId

public java.lang.String getUniqueSystemId(java.util.Properties propConfigPar)
                                   throws A2WException

Generates Unique System Id (USID)

Parameters:
propConfigPar - Properties list containing afp2web.ini parameters
For Windows OS, MACID(Physical Address of Network Interface Card) property must be set. For other OS propConfigPar can be null.

Returns:
  Returns USID String

 Throws de.maas.afp2web.A2WException in case of error

 
Example:
 String sUSIDTmp = a2wsdkThe.getUniqueSystemId( propConfigTmp );

 Use de.maas.afp2web.A2WIniConstants to set MacId parameter on Windows OS.

 For further details, please refer to AFP2web's User Guide and Reference.

 
Synopsis:
 try {

       // Create parameters list
       Properties propConfigTmp = new Properties();

       // Set MacId  attribute (Needed only for Windows OS)
       propConfigTmp.setProperty( A2WIniConstants.MACID, "00:84:3F:84:76:9A" );
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkthe = A2WSDK.getSingleton();
         ...
          ...
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkThe = A2WSDK.getSingleton();

       // Call conversion process of AFP2web SDK
       System.out.println( "Unique System Id:" + a2wsdkthe.getUniqueSystemId( propConfigTmp  ) );

   }
   catch ( A2WException a2weErrorPar ){
       System.out.println( "[GetUniqueSystemId] Error! " +
                            " Code:" +
                            a2weErrorPar.getErrorCode() +
                            " Msg: " +
                            a2weErrorPar.getMessage() );
   }

 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.lang.String[] sDocumentIdsPar,
                   A2WDocumentReader a2wDocReaderPar,
                   java.lang.String sOutputFilenamePar)
            throws A2WException

Converts N input documents to 1 output file, Input document will be retrieved using A2WDocumentReader callback implementation by passing in the document id given as parameter to this API, A2WDocumentReader's "read" function is called for each input document id. Output format is specified in properties parameter.

Parameters:
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
sDocumentIdsPar - String Array containing list of Document IDs of type java.lang.String[]
a2wDocReaderPar - A2WDocumentReader of type de.maas.afp2web.A2WDocumentReader
sOutputFilenamePar - File where output document has to be stored of type java.lang.String

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error
 
Remarks:
a. Only AFP input is allowed for this API
b. Only following file creation modes are allowed in this API
     "DOC_MERGE" or "DOC_COLD" 
c. Default file creation mode is "DOC_MERGE"
d. "NEW_DOC" return value from "afp2web" function of script procedure will be ignored for "DOC_COLD" e. Turning on "Autosplit" from script procedure will be ignored for "DOC_COLD"

Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      sDocumentIDsTmp,
                                      a2wDocReaderTmp,
                                      sOutputFilenameTmp );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.

 Parameter "sOutputFilenamePar" should contain valid filename with path where writing is permitted for AFP2web Java SDK.
 
Synopsis:

 int iRetTmp = 0;

 try {
     // Create output filename
     String sOutputFilenameTmp = "C:\\AFP2web\CheckOut\\build.afp";

     // Create parameters list
     Properties propConfigTmp = new Properties();

     // Set ini attributes
     propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
     propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
     propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
     ...
     ...
     // Get AFP2web SDK singleton instance
     A2WSDK a2wsdkThe = A2WSDK.getSingleton();

     // Create custom document reader
     CustomDocumentReader a2wDocReaderTmp = new CustomDocumentReader();

     // Create list of document ids
     String[] sDocumentIdsTmp = { "test1.afp", "test2.afp" };

     // Call conversion process of AFP2web SDK
     iRetTmp = a2wsdkThe.afp2web( propConfigTmp,
                                  sDocumentIdsTmp,
                                  a2wDocReaderTmp,
                                  sOutputFilenameTmp
                                );

     // process output file
     ...
     ...
 }
 catch ( A2WException a2weErrorPar ){
     iRetTmp = a2weErrorPar.getErrorCode();
     System.out.println( "[ConvertCheckOut] Error (rc=" +
                         iRetTmp +
                         "): " +
                         a2weErrorPar.getMessage() );
 }
 catch ( Throwable t ){
     iRetTmp = -2;
     t.printStackTrace();
 }

 Above sample program will have converted and merged output output on "sOutputFilenameTmp" directed file.

 Also refer to the AFP2webCheckOut.java sample provided with the AFP2web Java SDK.
 

Throws:
A2WException

afp2web

public int afp2web(java.util.Properties propConfigPar,
                   java.lang.String[] sDocumentIdsPar,
                   A2WDocumentReader a2wDocReaderPar,
                   java.io.ByteArrayOutputStream baosOutputStreamPar)
            throws A2WException

Converts N input documents to 1 output buffer, Input document will be retrieved using A2WDocumentReader callback implementation by passing in the document id given as parameter to this API, A2WDocumentReader's "read" function is called for each input document id. Output format is specified in properties parameter.

Parameters:
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
sDocumentIdsPar - String Array containing list of Document IDs of type java.lang.String[]
a2wDocReaderPar - A2WDocumentReader of type de.maas.afp2web.A2WDocumentReader
baosOutputStreamPar - Stream to receive output document buffer of type java.io.ByteArrayOutputStream

Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error
 
Remarks:
This API most suitable for TIFF2PDF Conversion

Example:
 int iRetCodeTmp = a2wsdkThe.afp2web( propConfigTmp,
                                      sDocumentIDsTmp,
                                      a2wDocReaderTmp,
                                      baosOutputStreamTmp );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.

 Parameter "baosOutputStreamPar" should contain valid ByteArrayOutputStream instance.
 
Synopsis:

 int iRetTmp = 0;

 try {
     // Allocate stream to hold Output buffer
     ByteArrayOutputStream baosOutputBufferTmp = new ByteArrayOutputStream();

     // Create parameters list
     Properties propConfigTmp = new Properties();

     // Set ini attributes
     propConfigTmp.setProperty( A2WIniConstants.INIPATH, "./" );
     propConfigTmp.setProperty( A2WIniConstants.QUIETMODE, "on" );
     propConfigTmp.setProperty( A2WIniConstants.OUTPUTFORMAT, "PDF" );
     ...
     ...
     // Get AFP2web SDK singleton instance
     A2WSDK a2wsdkThe = A2WSDK.getSingleton();

     // Create custom document reader
     CustomDocumentReader a2wDocReaderTmp = new CustomDocumentReader();

     // Create list of document ids
     String[] sDocumentIdsTmp = { "test1.afp", "test2.afp" };

     // Call conversion process of AFP2web SDK
     iRetTmp = a2wsdkThe.afp2web( propConfigTmp,
                                  sDocumentIdsTmp,
                                  a2wDocReaderTmp,
                                  baosOutputBufferTmp
                                );

       // process output buffer
         ...
         ...
 }
 catch ( A2WException a2weErrorPar ){
     iRetTmp = a2weErrorPar.getErrorCode();
     System.out.println( "[ConvertCheckOut] Error (rc=" +
                         iRetTmp +
                         "): " +
                         a2weErrorPar.getMessage() );
 }
 catch ( Throwable t ){
     iRetTmp = -2;
     t.printStackTrace();
 }

 System.exit( iRetTmp );

 Above sample program will receive converted and merged output output buffer on "baosOutputBufferTmp" variable.

 Also refer to the AFP2webCheckOutMem.java sample provided with the AFP2web Java SDK.
 

Throws:
A2WException

createCredit

public int createCredit(java.util.Properties propConfigPar,
                        java.lang.String sCreditFilePathPar)
                 throws A2WException

Creates the Credit file and UCID file

Parameters:
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
sCreditFilePathPar - Path to store credit file and UCID file
Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error
 

Example:
 int iRetCodeTmp = a2wsdkThe.createCredit(   propConfigTmp     
                                           , sCreditFilePathTmp
                                         );    

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.
 
Synopsis:

 int iRetTmp = 0;

 try{
        // Create parameters list
        Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.PROCESSINGMODE, A2WIniConstants.CREATECREDIT );
       String sCreditFilePathTmp ="./";
           
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkTmp = A2WSDK.getSingleton();
           
       if ( sCreditFilePathTmp != null ){
           // Invoke credit credit process of AFP2web SDK
            lRetTmp = a2wsdkTmp.createCredit(   propConfigTmp
                                              , sCreditFilePathTmp
                                            );
        }     
   }
   catch( A2WException a2weErrorPar ){
       lRetTmp = a2weErrorPar.getErrorCode();
       System.out.println(    "[AFP2web] Error (rc=" 
                           +  lRetTmp 
                           +  "): "
                           +  a2weErrorPar.getMessage()
                         );
   }
   catch( Throwable t ){
      lRetTmp = -2;
      t.printStackTrace();
   }
   
   System.exit( (int)lRetTmp );
 

Throws:
A2WException

importCredit

public int importCredit(java.util.Properties propConfigPar,
                        java.lang.String sVoucherFilenamePar)
                 throws A2WException

Import the credit from voucher file to credit file

Parameters:
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
sVoucherFilenamePar - Fully qualified voucher filename used to import the credit
Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error
 

Example:
 int iRetCodeTmp = a2wsdkThe.importCredit(   propConfigTmp
                                           , sVoucherFilenameTmp
                                         );     

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.
 
Synopsis:

 int iRetTmp = 0;

 try{
        // Create parameters list
        Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.PROCESSINGMODE, A2WIniConstants.IMPORTCREDIT );
       propConfigTmp.setProperty( A2WIniConstants.CREDITFILEPATH, "./" );     

       String sVoucherFilenameTmp = "./xyz.a2w";
           
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkTmp = A2WSDK.getSingleton();
           
       if ( sVoucherFilenameTmp != null ){
           // Invoke credit credit process of AFP2web SDK
            lRetTmp = a2wsdkTmp.importCredit(   propConfigTmp
                                              , sVoucherFilenameTmp
                                            );
        }     
   }
   catch( A2WException a2weErrorPar ){
       lRetTmp = a2weErrorPar.getErrorCode();
       System.out.println(    "[AFP2web] Error (rc=" 
                           +  lRetTmp 
                           +  "): "
                           +  a2weErrorPar.getMessage()
                         );
   }
   catch( Throwable t ){
      lRetTmp = -2;
      t.printStackTrace();
   }
   
   System.exit( (int)lRetTmp );
 

Throws:
A2WException

exportCredit

public int exportCredit(java.util.Properties propConfigPar,
                        java.lang.String sUCIDFilenamePar)
                 throws A2WException

Used to move AFP2web installation from one location to another location

Parameters:
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
sUCIDFilenamePar - Fully qualified UCID filename used to export the credit
Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error
 

Example:
 int iRetCodeTmp = a2wsdkThe.exportCredit(   propConfigTmp
                                           , sUCIDFilenameTmp
                                         );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.
 
Synopsis:

 int iRetTmp = 0;

 try{
        // Create parameters list
        Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.PROCESSINGMODE, A2WIniConstants.EXPORTCREDIT );
       propConfigTmp.setProperty( A2WIniConstants.CREDITFILEPATH, "./" );

       String sUCIDFilenameTmp = "./abc.ucid";
           
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkTmp = A2WSDK.getSingleton();

       // Invoke credit credit process of AFP2web SDK
        lRetTmp = a2wsdkTmp.exportCredit(   propConfigTmp
                                          , sUCIDFilenameTmp
                                         );
   }
   catch( A2WException a2weErrorPar ){
       lRetTmp = a2weErrorPar.getErrorCode();
       System.out.println(    "[AFP2web] Error (rc=" 
                           +  lRetTmp 
                           +  "): "
                           +  a2weErrorPar.getMessage()
                         );
   }
   catch( Throwable t ){
      lRetTmp = -2;
      t.printStackTrace();
   }
   
   System.exit( (int)lRetTmp );
 

Throws:
A2WException

displayCredit

public int displayCredit(java.util.Properties propConfigPar,
                         java.lang.String sCreditFilePathPar)
                  throws A2WException

Used to display the available credit

Parameters:
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
Returns:
  0 on Success
 <0 on Error

 Throws de.maas.afp2web.A2WException in case of error
 

Example:
 int iRetCodeTmp = a2wsdkThe.displayCredit(   propConfigTmp
                                            , sCreditFilePathTmp
                                          );

 Use de.maas.afp2web.A2WIniConstants to set any afp2web.ini parameters.

 For further details, please refer to AFP2web's User Guide and Reference.
 
Synopsis:

 int iRetTmp = 0;

 try{
        // Create parameters list
        Properties propConfigTmp = new Properties();

       // Set ini attributes
       propConfigTmp.setProperty( A2WIniConstants.PROCESSINGMODE, A2WIniConstants.DISPLAYCREDIT );
       propConfigTmp.setProperty( A2WIniConstants.CREDITFILEPATH, "./" );     
           
       // Get AFP2web SDK singleton instance
       A2WSDK a2wsdkTmp = A2WSDK.getSingleton();

       // Invoke credit credit process of AFP2web SDK
       lRetTmp = a2wsdkTmp.displayCredit(   propConfigTmp
                                          , sCreditFilePathTmp
                                        );

   }
   catch( A2WException a2weErrorPar ){
       lRetTmp = a2weErrorPar.getErrorCode();
       System.out.println(    "[AFP2web] Error (rc=" 
                           +  lRetTmp 
                           +  "): "
                           +  a2weErrorPar.getMessage()
                         );
   }
   catch( Throwable t ){
      lRetTmp = -2;
      t.printStackTrace();
   }
   
   System.exit( (int)lRetTmp );
 

Throws:
A2WException

getVersion

public java.lang.String getVersion()
Get version string of AFP2web SDK

Returns:
AFP2web SDK version string

Example:
 A2WSDK a2wsdkthe = A2WSDK.getSingleton();
 System.out.println( a2wsdkthe.getVersion() );
 


getVersionAll

public java.lang.String getVersionAll()
Get version of all sub components string of AFP2web SDK

Returns:
AFP2web SDK version of all sub components string

Example:
 A2WSDK a2wsdkthe = A2WSDK.getSingleton();
 System.out.println( a2wsdkthe.getVersionAll() );
 


getUniqueSystemId

public java.lang.String getUniqueSystemId()
Get Unique System Id

Returns:
Unique System Id

Example:
 A2WSDK a2wsdkthe = A2WSDK.getSingleton();
 System.out.println( a2wsdkthe.getUniqueSystemId() );