JAVA Application Programming Interfaces
The AFP2PDF Plus Transform APIs use data buffers for input and output to the transform. Many times the AFP data is retrieved from a database in a byte array in memory. The reference to this byte array is then passed directly to the conversion code for processing. The output from the API program also uses a reference to a byte array that contains the transformed output. Therefore, the overhead of opening, reading, and closing files is eliminated. Because system performance degrades if very large byte arrays are allocated, this approach assumes that the input and output byte arrays are not extremely large. The command–line interface, which uses files for input and output to the transform, might need to be used for very large byte arrays.
This chapter contains information about the programming functions available for the
AFP2PDF Plus Transform API. They mimic the previous AFP2PDF JAVA APIs and are designed
to integrate into existing AFP2PDF installations with minimal migration
effort. For more detailed information, see the Javadoc
information in the api
subdirectory.
- A2PBufferMessages (boolean flag)
- Sets up the logging to buffer messages, which are returned via A2PGetMessageBuffer() method. The default message level is WARNING.
- A2PBufferMessages (boolean flag, java.lang.String level)
- Sets up the logging to buffer messages, which are returned via A2PGetMessageBuffer() method.
- Message levels: INFO, WARNING, SEVERE, ALL.
- A2PDocEnd ()
- Terminates the processing for the last AFP document transform.
- A2PDocStart2 (byte[ ] ResIn, byte[ ] DataIn, java.lang.String InstallDir)
- Initializes the transform processing for an AFP document and resource group file contained in the input byte array. The resulting output PDF must be obtained through the method getPDFOutBuf().
- A2PDocStart2 (byte[ ] DataIn, java.lang.String InstallDir)
- Initializes the transform processing for an AFP document contained in the input byte array. The resulting output PDF must be obtained through the method getPDFOutBuf ().
- A2PDocStart2 (java.lang.String inAFPFileName, java.lang.String outPDFFileName, java.lang.String resGrpFileName)
- Initializes the transform processing for an AFP document, resource group and output
file using the input file names. The resulting output PDF is written to the output
PDF file name, whether supplied or derived. A call to the method getPDFOutBuf () l returns null, as the method is only useful when other A2PDocStart2 () methods are used.
Note: You must call setFormDef () and setOptionsFile () before calling A2PDocStart2 ().
- A2PGenerateMessages (boolean fGen)
- This command can be specified, but it is not supported in the current implementation. It exists for compatibility purposes only.
- A2PGetMessageBuffer ()
- Returns the string of log messages since the last XFormDoc.
- A2PGetPageCount ()
- Returns the number of pages in a specific AFP document. A value greater than 0 indicates a successful completion. A zero value or negative number indicates that an error has occurred.
- A2PXFormDoc ()
- Transforms the entire AFP document using the given values already set.
- A2PXFormPage ()
- Transforms one or more pages in an AFP document using the given values already set. The setPageNumber method must be used before this method to choose which page to convert. If the last page number is also set, the range of pages is transformed.
- A2PXFormPage (int n)
- Transforms a specific page in an AFP document using the given values already set.
- A2PXFormPage (int StartPageNumber, int EndPageNumber, boolean LastPage)
- Transforms a range of pages in an AFP document using the given values already set. Both StartPageNumber and EndPageNumber must be less than or equal to the number of pages in the document. StartPageNumber must be less than or equal to EndPageNumber.
- GetCachedFontMapInfo ()
- Returns a string of all font directories currently cached.
- getCodeVersion ()
- This command can be specified, but it is not supported in the current implementation. It exists for compatibility purposes only.
- getCreateTimeStamp ()
- This command can be specified, but it is not supported in the current implementation. It exists for compatibility purposes only.
- getFontPath ()
- Gets the value of the Font Path variable.
- getFormDef ()
- Gets the value of the FormDef variable and returns the fully qualified path name of the form definition file. This value can be null.
- getImageMapFile ()
- Retrieves the location of the name of the image map configuration file.
- getLastPageNumber ()
- Returns the last page number (1-based) to transform.
- getLinearize ()
- Returns True when the linearized option is set.
- For more information, see setLinearize (boolean n).
- getOptionsFile ()
- Gets the value of the OptionsFile variable and returns the fully qualified file path of the
a2pxopts.cfg
file. This value can be null. - getOwnerPassWord ()
- Gets the value of the OwnerPW variable and returns the owner password. This value can be null.
- getPageNumber ()
- Returns the first page number (1-based) to transform.
- getPDFOutBuf ()
- Gets the PDF output byte array. This value can be null if an error occurred or files were used for IO.
- getPermissions ()
- Gets the value of the Permissions variable.
- getRotation ()
- Gets the value of the Rotation variable and returns the rotation setting (0 | 90 | 180 | 270).
- getSignTimeStamp ()
- This command can be specified, but it is not supported in the current implementation. It exists for compatibility purposes only.
- getUserPassWord ()
- Gets the value of the UserPW variable and returns the user password. This value can be null.
- getXFormDocParameters ()
- Returns a list of parameters and their current values.
- InitFontMaps (String fontDir)
- Initializes the font mapping information for the input font directory. This command can be called multiple times and is used to eliminate the initial costs of reading font mapping data when the first file is transformed. The fontDir variable is the fully qualified path name of the font map directory.
- setCachingSize (int size)
- Sets the maximum size of the resource cache used across all transforms within a Java Virtual Machine.
- setCreateTimeStamp (java.lang.String n)
- This command can be specified, but it is not supported in the current implementation. It exists for compatibility purposes only.
- setFontPath ()
- Sets the value of the Font Path variable.
- setFormDef (java.lang.String n)
- Sets the fully qualified form definition file name.
Note: This value must be set before calling A2PDocStart2 ().
- setImageMapFile (java.lang.String n)
- Specifies the location and the name of the image map configuration file, different
from the default file,
imagemap.cfg
. The file name does not use relative paths and is fully qualified. See JAVA Application Programming Interfaces for more information about the image map configuration file. - setLastPageNumber (int n)
- Sets the last page number (1-based) to transform. If the first page number is not
already set using setPageNumber(), it is set here to the first page. For example, you can transform the first 33 pages
by just setting the last page number to
33
. - setLinearize (boolean n)
- Specifies that the output PDF file is created linearized (or optimized for Fast web viewing).
- setOptionsFile (java.lang.String n)
- Sets the OptionsFile variable.
Note: This value must be set before calling A2PDocStart2 ().
- setOwnerPassWord (java.lang.String n)
- Sets the OwnerPW variable.
- setPageNumber (int n)
- Sets the first page number (1-based) to transform.
- setPermissions (java.lang.String n)
- Sets the Permissions variable.
- setRotation (int n)
- Sets the Rotation variable (0 | 90 | 180 | 270).
- setSignTimeStamp (java.lang.String n)
- This command can be specified, but it is not supported in the current implementation. It exists for compatibility purposes only.
- setUserPassWord (java.lang.String n)
- Sets the UserPW variable.
- writeDataBuf (java.lang.String fName)
- Writes the current AFP data bytes to the output file name. This value cannot be null.