Manual - UPC Extension 5

Introduction

UPC extension with 5 digits must be joined with a UPC or EAN code in order to add relevant information about the product to sell. The reader should read in both barcodes in one shot and return the UPC and then the extension code.

Usually, the encoded information is the suggested price of the selected product.
If the first number is 0, the price xx.xx is expressed in British Pounds. If the first number is a 5, the price is expressed in U.S Dollars.
Some special codes exist:

  • 90000 : No suggested retail price
  • 99991 : The item is a complementary of another one. Usually free
  • 99990 : Used by National Association of College Stores to mark "used book"
  • 90001 to 98999 : Internal purposes for some publishers

This class inherits the BCGBarcode1D class.

Example

Methods

BCGupcext5's Methods

  • No specific methods for this class.

BCGBarcode1D's Methods

BCGBarcode's Methods

Code Example

S

var font = new BCGFont(new Font("Arial", 18));
var colorBlack = new BCGColor(Color.Black);
var colorWhite = new BCGColor(Color.White);

// Barcode Part
var code = new BCGupcext5();
code.SetScale(2);
code.SetThickness(30);
code.SetForegroundColor(colorBlack);
code.SetBackgroundColor(colorWhite);
code.SetFont(font);
code.Parse("55499");

// Drawing Part
var drawing = new BCGDrawing(code, colorWhite);

var memoryStream = new MemoryStream();
await drawing
    .FinishAsync(BCGDrawing.ImageFormat.Png, memoryStream);

Method explanations

  • GetThickness() — Returns the thickness of the barcode
    Description
    The thickness of the barcode in pixels. The value isn't multiplied by the scale.
    Returns
    int - value in pixels
  • SetThickness(int thickness) — Specifies the thickness of the barcode
    Description
    The thickness of the barcode in pixels. This is the vertical size.
  • GetLabel() — Gets the label
    Description
    Returns the real value that will be displayed with the barcode. You have to have called the Parse() method first.
    Returns
    string - final label
  • SetLabel(string label) — Sets the label
    Description
    The text label will be written below or above the barcode depending on the barcode. You can write the special value BCGBarcode1D.Label if you would like your text to be chosen automatically. It will be the value passed to the Parse() method.
  • GetFont() — Gets the text font for the label
    Description
    Gets the text font for the label.
    Returns
  • SetFont(BCGFont font) — Sets the text font for the label
    Description
    The value of the argument must be an instance of the BCGFontFile class.
  • GetChecksum() — Gets the checksum appended to the barcode
    Description
    Returns the value that will be appended to the barcode. This method must be called after the method Parse().
    Returns
    int - checksum added or false if no checkum is included
  • SetDisplayChecksum(bool display) — Specifies the checksum to be added to the label
    Description
    Setting true will append the checksum to the default label.
    The default value is true.
  • Parse(string text) — Analyzes a text message to draw afterwards
    Description
    The data you pass to the text argument must be supported by the type of barcode you use.
    Check each barcode's introduction section to obtain more information on how to use this method within each symbology.
  • Draw(Graphics image) — Draws the barcode on the image
    Description
    The value of the image argument must be an image resource. The size of the image can be defined by the value received from GetDimension().
  • GetDimension(int width, int height) — Returns an array containing the required size for the image
    Description
    Returns an array in which the first index is the image width and the second index is the image height.
    The arguments are used to specify the starting point of the drawing. Should be 0 for both.
    The BCGDrawing class uses this method to create the image resource.
    Returns
    array(int, int) - [0] is the width, [1] is the height
  • GetScale() — Gets the scale of the barcode
    Description
    Gets the scale of the barcode. The value is the number of the "smallest" unit in pixel.
    Returns
    int - value in pixels
  • SetScale(int scale) — Sets the scale of the barcode
    Description
    The barcode will be x times bigger. Then a pixel will be x by x for its size.
  • GetForegroundColor() — Gets the color of the bars
    Description
    Gets the color of the bars of the barcode.
    Returns
  • SetForegroundColor(BCGColor color) — Sets the color of the bars
    Description
    Sets the color of the bars of the barcode. By default, the color is black. This argument can be a BCGColor class or any other argument that BCGColor can accept in its constructor.
  • GetBackgroundColor() — Gets the color of the spaces
    Description
    Gets the color of the spaces of the barcode.
    Returns
  • SetBackgroundColor(BCGColor color) — Sets the color of the spaces
    Description
    Sets the color of the spaces of the barcode. By default, the color is white. This argument can be a BCGColor class or any other argument that BCGColor can accept in its constructor.
  • SetColor(BCGColor foregroundColor, BCGColor backgroundColor) — Sets the color of the bars and spaces
    Description
    An easy and fast method to set the color of the bars and spaces. Check the SetForegroundColor() and SetBackgroundColor().
  • GetOffsetX() — Gets the X offset
    Description
    Gets the X offset of the barcode in pixels. The value isn't multiplied by the scale.
    Returns
    int - value in pixels
  • SetOffsetX(int value) — Sets the X offset
    Description
    Specifies the X offset of the barcode in pixels multiplied by the scale. The required size returned by GetDimension() will be modified accordingly.
  • GetOffsetY() — Gets the Y offset
    Description
    Gets the Y offset of the barcode in pixels. The value isn't multiplied by the scale.
    Returns
    int - value in pixels
  • SetOffsetY(int value) — Sets the Y offset
    Description
    Specifies the Y offset of the barcode in pixels multiplied by the scale. The required size returned by GetDimension() will be modified accordingly.
  • AddLabel(BCGLabel label) — Adds a label to the graphic
    Description
    Adds a BCGLabel object to the drawing.
  • RemoveLabel(BCGLabel label) — Removes a label from the graphic
    Description
    Removes a specific BCGLabel object from the drawing.
  • ClearLabels() — Removes the labels from the graphic
    Description
    Clears the BCGLabel objects from the drawing.