cete.dynamicpdf.pageelements.barcoding.code128
Code128
- Namespace: ceTe.DynamicPDF.PageElements.BarCoding
- Assemblies: ceTe.DynamicPDF.40.dll
Represents a Code 128 barcode.
public class Code128 : TextBarCode, ICoordinate, ISerializable
Public Class Code128
Inherits TextBarCode
Implements ICoordinate, ISerializable
Inheritance: Object → PageElement → TaggablePageElement → RotatingPageElement → BarCode → TextBarCode → Code128
Implements: ICoordinate, ISerializable
Licensing
This class is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
Examples
The following example will place a Code 128 barcode on the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements.BarCoding
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a barcode
Dim barCode As Code128 = New Code128("Code 128 Barcode.", 50, 50, 48, 0.75F)
' Add the barcode to the page
MyPage.Elements.Add(barCode)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements.BarCoding;
class MyClass
{
static void Main()
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add( page );
// Create a barcode
Code128 barCode = new Code128("Code 128 Barcode.", 50, 50, 48, 0.75F);
// Add the barcode to the page
page.Elements.Add( barCode );
// Save the PDF
document.Draw( @"C:\MyDocument.pdf" );
}
}
Remarks
This class can be used to place a Code 128 barcode on a page.
Constructors
Code128(String, Single, Single, Single)
Initializes a new instance of the Code128 class.
public Code128(string value, float x, float y, float height)
Public Sub New (value As String, x As Single, y As Single, height As Single)
Parameters
- value: String
The value of the barcode.
- x: Single
The X coordinate of the barcode.
- y: Single
The Y coordinate of the barcode.
- height: Single
The height of the barcode.
Remarks
Code sets can be specified along with data, in order to do this ProcessTilde property needs to be set to true .
Example value: "~BHello AWORLD 1C2345", where ~A, ~B and ~C representing code sets A, B and C respectively.
However if any inline code set has invalid characters it will be shifted to an appropriate code set.
Code128(String, Single, Single, Single, Boolean)
Initializes a new instance of the Code128 class.
public Code128(string value, float x, float y, float height, bool showText)
Public Sub New (value As String, x As Single, y As Single, height As Single, showText As Boolean)
Parameters
- value: String
The value of the barcode.
- x: Single
The X coordinate of the barcode.
- y: Single
The Y coordinate of the barcode.
- height: Single
The height of the barcode.
- showText: Boolean
true to display value of barcode as text. Otherwise, display barcode only.
Remarks
Code sets can be specified along with data, in order to do this ProcessTilde property needs to be set to true .
Example value: "~BHello AWORLD 1C2345", where ~A, ~B and ~C representing code sets A, B and C respectively.
However if any inline code set has invalid characters it will be shifted to an appropriate code set.
Code128(String, Single, Single, Single, Font, Single)
Initializes a new instance of the Code128 class.
public Code128(string value, float x, float y, float height, Font font, float fontSize)
Public Sub New (value As String, x As Single, y As Single, height As Single, font As Font, fontSize As Single)
Parameters
- value: String
The value of the barcode.
- x: Single
The X coordinate of the barcode.
- y: Single
The Y coordinate of the barcode.
- height: Single
The height of the barcode.
- font: Font
The font to use when displaying text.
- fontSize: Single
The font size to use when displaying text.
Remarks
Code sets can be specified along with data, in order to do this ProcessTilde property needs to be set to true .
Example value: "~BHello AWORLD 1C2345", where ~A, ~B and ~C representing code sets A, B and C respectively.
However if any inline code set has invalid characters it will be shifted to an appropriate code set.
Code128(String, Single, Single, Single, Single)
Initializes a new instance of the Code128 class.
public Code128(string value, float x, float y, float height, float xDimension)
Public Sub New (value As String, x As Single, y As Single, height As Single, xDimension As Single)
Parameters
- value: String
The value of the barcode.
- x: Single
The X coordinate of the barcode.
- y: Single
The Y coordinate of the barcode.
- height: Single
The height of the barcode.
- xDimension: Single
The XDimension of the barcode.
Remarks
Code sets can be specified along with data, in order to do this ProcessTilde property needs to be set to true .
Example value: "~BHello AWORLD 1C2345", where ~A, ~B and ~C representing code sets A, B and C respectively.
However if any inline code set has invalid characters it will be shifted to an appropriate code set.
Code128(String, Single, Single, Single, Single, Boolean)
Initializes a new instance of the Code128 class.
public Code128(string value, float x, float y, float height, float xDimension, bool showText)
Public Sub New (value As String, x As Single, y As Single, height As Single, xDimension As Single, showText As Boolean)
Parameters
- value: String
The value of the barcode.
- x: Single
The X coordinate of the barcode.
- y: Single
The Y coordinate of the barcode.
- height: Single
The height of the barcode.
- xDimension: Single
The XDimension of the barcode.
- showText: Boolean
true to display value of barcode as text. Otherwise, display barcode only.
Remarks
Code sets can be specified along with data, in order to do this ProcessTilde property needs to be set to true .
Example value: "~BHello AWORLD 1C2345", where ~A, ~B and ~C representing code sets A, B and C respectively.
However if any inline code set has invalid characters it will be shifted to an appropriate code set.
Code128(String, Single, Single, Single, Single, Font, Single)
Initializes a new instance of the Code128 class.
public Code128(string value, float x, float y, float height, float xDimension, Font font, float fontSize)
Public Sub New (value As String, x As Single, y As Single, height As Single, xDimension As Single, font As Font, fontSize As Single)
Parameters
- value: String
The value of the barcode.
- x: Single
The X coordinate of the barcode.
- y: Single
The Y coordinate of the barcode.
- height: Single
The height of the barcode.
- xDimension: Single
The XDimension of the barcode.
- font: Font
The font to use when displaying text.
- fontSize: Single
The font size to use when displaying text.
Remarks
Code sets can be specified along with data, in order to do this ProcessTilde property needs to be set to true .
Example value: "~BHello AWORLD 1C2345", where ~A, ~B and ~C representing code sets A, B and C respectively.
However if any inline code set has invalid characters it will be shifted to an appropriate code set.
Properties
Angle
Gets or sets the heights of the angle element. (Inherited from RotatingPageElement)
public float Angle { get; set; }
Public Property Angle As Single
Property Value
Color
Gets or sets the Color of the barcode. (Inherited from BarCode)
public Color Color { get; set; }
Public Property Color As Color
Property Value
ContinueToNextSymbol
Gets or sets if the barcode will be continued to another Code 128 barcode.
public bool ContinueToNextSymbol { get; set; }
Public Property ContinueToNextSymbol As Boolean
Property Value
Remarks
If true a FNC2 code will be the first (second if IsUCCEAN128 is true ) character in the barcode.
Font
Gets or sets the font to use when displaying the text. (Inherited from TextBarCode)
public Font Font { get; set; }
Public Property Font As Font
Property Value
FontSize
Gets or sets the font size to use when displaying the text. (Inherited from TextBarCode)
public float FontSize { get; set; }
Public Property FontSize As Single
Property Value
Height
Gets or sets the heights of the page element. (Inherited from RotatingPageElement)
public float Height { get; set; }
Public Property Height As Single
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
IsUCCEAN128
Gets or sets if the barcode is a UCC / EAN Code 128 barcode.
public bool IsUCCEAN128 { get; set; }
Public Property IsUCCEAN128 As Boolean
Property Value
Remarks
If true a FNC1 code will be the first character in the barcode.
LookAhead
Gets or sets the number of characters to look ahead when determining the best mode.
public int LookAhead { get; set; }
Public Property LookAhead As Int32
Property Value
Remarks
This is used initially and when switching from Mode C.
PixelsPerXDimension
Gets or Sets the pixels per XDimension (Inherited from BarCode)
public int PixelsPerXDimension { get; set; }
Public Property PixelsPerXDimension As Int32
Property Value
ProcessTilde
Gets or Sets a boolean indicating whether to process the tilde character.
public bool ProcessTilde { get; set; }
Public Property ProcessTilde As Boolean
Property Value
Remarks
If true checks for fnc1 (~1) character in the barcode Value and checks for the inline code sets if present in the data to process.
Example value: "~BHello AWORLD 1C2345", where ~A, ~B and ~C representing code sets A, B and C respectively.
However if any inline code set has invalid characters it will be shifted to an appropriate code set.
"" is used as an escape character to add ~.
ShowText
Gets or sets a value indicating if the value should be placed as text below the barcode. (Inherited from TextBarCode)
public bool ShowText { get; set; }
Public Property ShowText As Boolean
Property Value
Tag
Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement)
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
Licensing
This property is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
TextAlign
Gets or sets the alignment of the text. (Inherited from TextBarCode)
public Align TextAlign { get; set; }
Public Property TextAlign As Align
Property Value
TextColor
Gets or set the color of the text. (Inherited from TextBarCode)
public Color TextColor { get; set; }
Public Property TextColor As Color
Property Value
Value
Gets or sets the value of the barcode. (Inherited from BarCode)
public string Value { get; set; }
Public Property Value As String
Property Value
X
Gets or sets the X coordinate of the page element. (Inherited from RotatingPageElement)
public float X { get; set; }
Public Property X As Single
Property Value
XDimension
Gets or sets the XDimension of the barcode. (Inherited from BarCode)
public float XDimension { get; set; }
Public Property XDimension As Single
Property Value
XDimensionMilliMeters
Gets or sets the XDimensionMilliMeters of the barcode. (Inherited from BarCode)
public float XDimensionMilliMeters { get; set; }
Public Property XDimensionMilliMeters As Single
Property Value
XDimensionMils
Gets or sets the XDimensionMils of the barcode. (Inherited from BarCode)
public float XDimensionMils { get; set; }
Public Property XDimensionMils As Single
Property Value
XDimensionsPerCentiMeter
Gets or sets the XDimensionsPerCentiMeter of the barcode. (Inherited from BarCode)
public float XDimensionsPerCentiMeter { get; set; }
Public Property XDimensionsPerCentiMeter As Single
Property Value
XDimensionsPerInch
Gets or sets the XDimensionsPerInch of the barcode. (Inherited from BarCode)
public float XDimensionsPerInch { get; set; }
Public Property XDimensionsPerInch As Single
Property Value
Y
Gets or sets the Y coordinate of the page element. (Inherited from RotatingPageElement)
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws the page element to the given PageWriter object. (Inherited from RotatingPageElement)
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the page element's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetSymbolWidth()
Returns the width required to display the full barcode.
public float GetSymbolWidth()
Function GetSymbolWidth() As Single
Returns
A value representing the required width.
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .