43
Chapter 4 API Reference
4
addTextAlign
Adds the text alignment setting to the command buffer.
Syntax
public void addTextAlign(int align) throws EposException
Parameter
align : Specifies the text alignment.
Exceptions
When processing fails, EposException is thrown with one of the following error values.
Example
This API setting also applies to barcodes/2D-Code.
When the page mode is selected for the print mode, use addPagePosition (p.76) instead of this
API to set the alignment.
Set value Description
Builder.ALIGN_LEFT (default) Alignment to the left
Builder.ALIGN_CENTER Alignment to the center
Builder.ALIGN_RIGHT Alignment to the right
Error status Description
ERR_PARAM Invalid parameter was passed.
ERR_MEMORY Could not allocate memory.
ERR_FAILURE An unspecified error occurred.
To set alignment to the center:
try {
Builder builder = new Builder("TM-T88V", Builder.MODEL_ANK);
builder.addTextAlign(Builder.ALIGN_CENTER);
///Process///
} catch (EposException e) {
int errStatus = e.getErrorStatus();
}