Skip to end of metadata
Go to start of metadata
Contents Summary
  

Control the appearance of Code text

Aspose.BarCode provides complete control over the appearance of the Code text in the barcode image. There are many settings that can be applied on the Code text to customize its appearance as discussed below

Location of Code text

Aspose.BarCode gives full power to developers to decide that whether they want to display Code text or not. Moreover, it is also possible to customize that where to display the Code text (that is display above or below the barcode) as shown below in the figure.

All possible locations of Code text on the barcode image

All barcode generating classes have a CodeLocation property that can accept any pre-defined value stored in Aspose.BarCode.CodeLocation enumeration.The pre-defined values in CodeLocation enumeration are listed below.

Code Locations

Description 

Above

Specifies that the Code text is shown on the top of the bar code

Right 

Specifies that the Code text is shown on the right side of the bar code

Below 

Specifies that the Code text is shown on the bottom of the bar code

None 

Specifies that the Code text is hidden

 

Alignment of Code text

Horizontal alignment of the Code text can be configured by making use of CodeTextAlignment property of any barcode generating class in Aspose.BarCode.CodeTextAlignment property accepts any enumerated value in System.Drawing.StringAlignment enumeration. The pre-defined values in StringAlignment enumeration are listed below

Alignment Types

Description 

Center 

Specifies that text is aligned in the center of the layout rectangle

Far 

Specifies that text is aligned far from the origin position of the layout rectangle. In a left-to-right layout, the far position is right. In a right-to-left layout, the far position is left

Near 

Specifies the text be aligned near the layout. In a left-to-right layout, the near position is left. In a right-to-left layout, the near position is right

 

Fore color of Code text

Developers who want to add colors to their barcodes, may also change the color of Code text. Setting the CodeTextColor property of any barcode generating class to any color can change the fore color of the Code text as demonstrated below in a code snippet.

 

Set Code Text Font Family Name and Size

Setting the CodeTextFont property of any barcode generating class to any font family name and its size of the Code text as demonstrated below in a code snippet.

 

Space between Code text & Barcode

You saw above in the barcode image that the default gap between the barcode and Code text is very small. Developers can increase/decrease the space (gap) between the barcode and Code text by setting the CodeTextSpace Members property of any barcode generating class provided by Aspose.BarCode. The following code snippet shows you how to space between code text and Barcode.

 

A complete example is given below that combines all possible format settings that can be applied on the Code text to control its appearance.

Labels
  • No labels