yobryon / ngx-barcode

An angular component for Angular 4+ for creating 1-D barcodes based on Lindell's JsBarcode
https://yobryon.github.io/ngx-barcode
81 stars 53 forks source link

alphanumeric values not generating barcodes #14

Open kathu-wk opened 6 years ago

kathu-wk commented 6 years ago

Can't generate barcode for alpha numeric values. Tried CODE128, CODE128B, CODE39. If its just numbers its working fine.

This is not working. But if i rremove A from the bc-value it is generating bar code. Am I missing something? <ngx-barcode [bc-element-type]="svg" [bc-value]="A121234" [bc-format]="CODE128B" [bc-width]="2" [bc-height]="100" [bc-display-value]="true" [bc-font-options]="" [bc-font]="monospace" [bc-text-align]="center" [bc-text-position]="bottom" [bc-text-margin]="2" [bc-font-size]="20" [bc-margin]="10" [bc-margin-top]="10" [bc-margin-bottom]="10" [bc-margin-left]="10" [bc-margin-right]="10">

ohanraj commented 6 years ago

config this values in Component


 elementType = 'svg';
  value = 'ydsa!2323453';
  format = 'CODE128';
  lineColor = '#000000';
  width = 2;
  height = 100;
  displayValue = true;
  fontOptions = '';
  font = 'monospace';
  textAlign = 'center';
  textPosition = 'bottom';
  textMargin = 2;
  fontSize = 20;
  background = '#ffffff';
  margin = 10;
  marginTop = 10;
  marginBottom = 10;
  marginLeft = 10;
  marginRight = 10;

Use this in Html

<ngx-barcode *ngFor="let bcValue of values"
      [bc-element-type]="elementType"
      [bc-value]="bcValue"
      [bc-format]="format"
      [bc-line-color]="lineColor"
      [bc-width]="width"
      [bc-height]="height"
      [bc-display-value]="displayValue"
      [bc-font-options]="fontOptions"
      [bc-font]="font"
      [bc-text-align]="textAlign"
      [bc-text-position]="textPosition"
      [bc-text-margin]="textMargin"
      [bc-font-size]="fontSize"
      [bc-background]="background"
      [bc-margin]="margin"
      [bc-margin-top]="marginTop"
      [bc-margin-bottom]="marginBottom"
      [bc-margin-left]="marginLeft"
      [bc-margin-right]="marginRight"
    ></ngx-barcode>