|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectde.maas.afp2web.A2WSDK
public class A2WSDK
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 |
|---|
public static A2WSDK getSingleton()
public java.lang.String getActiveSpoolname()
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.
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
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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
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.
A2WException
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.
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
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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
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.
A2WException
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.
propConfigPar - Properties list containing afp2web.ini parameters
sarrFileNameListPar - String Array containing list of filenames
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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
A2WException
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.
propConfigPar - Properties list containing afp2web.ini parameters
sarrFileNameListPar - String Array containing list of filenames
a2wDocumentHandlerPar - A2WDocumentHandler
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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
A2WException
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.
propConfigPar - Properties list containing afp2web.ini parameters
sarrFileNameListPar - String Array containing list of filenames
a2wDocumentWriterPar - A2WDocumentWriter
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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
A2WException
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.
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
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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
A2WException
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.
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
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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
A2WException
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.
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
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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
A2WException
public java.lang.String getUniqueSystemId(java.util.Properties propConfigPar)
throws A2WException
Generates Unique System Id (USID)
propConfigPar - Properties list containing afp2web.ini parameters
Returns USID String Throws de.maas.afp2web.A2WException in case of error
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.
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() );
}
A2WException
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.
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
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
"DOC_MERGE" or "DOC_COLD"
c. Default file creation mode is "DOC_MERGE"
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.
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.
A2WException
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.
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
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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.
A2WException
public int createCredit(java.util.Properties propConfigPar,
java.lang.String sCreditFilePathPar)
throws A2WException
Creates the Credit file and UCID file
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
sCreditFilePathPar - Path to store credit file and UCID file
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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 );
A2WException
public int importCredit(java.util.Properties propConfigPar,
java.lang.String sVoucherFilenamePar)
throws A2WException
Import the credit from voucher file to credit file
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
sVoucherFilenamePar - Fully qualified voucher filename used to import the credit
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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 );
A2WException
public int exportCredit(java.util.Properties propConfigPar,
java.lang.String sUCIDFilenamePar)
throws A2WException
Used to move AFP2web installation from one location to another location
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
sUCIDFilenamePar - Fully qualified UCID filename used to export the credit
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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 );
A2WException
public int displayCredit(java.util.Properties propConfigPar,
java.lang.String sCreditFilePathPar)
throws A2WException
Used to display the available credit
propConfigPar - Properties list containing AFP2web INI parameters of type java.util.Properties
0 on Success <0 on Error Throws de.maas.afp2web.A2WException in case of error
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.
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 );
A2WExceptionpublic java.lang.String getVersion()
A2WSDK a2wsdkthe = A2WSDK.getSingleton(); System.out.println( a2wsdkthe.getVersion() );
public java.lang.String getVersionAll()
A2WSDK a2wsdkthe = A2WSDK.getSingleton(); System.out.println( a2wsdkthe.getVersionAll() );
public java.lang.String getUniqueSystemId()
A2WSDK a2wsdkthe = A2WSDK.getSingleton(); System.out.println( a2wsdkthe.getUniqueSystemId() );
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||