"Reprint" barcode.js powerful barcode generation jquery Plugin

Source: Internet
Author: User
Tags jquery library

This article is reproduced from http://www.uedsc.com/barcode-js.html

Barcode.js is a jquery library-based plug-in for drawing barcodes or QR codes that can generate barcodes based on div+css or canvas, which supports php,jquery and JavaScript, and 3 directories after decompression. Each directory has a corresponding example can be viewed.

Note: You need to draw the barcode/two-D code length and string containing letters and so on, note to choose a different barcode/two-D code type, or can not be drawn (the bar code has not been studied, the test depends on this). It is recommended to select code128 directly.

How to use

1, like other jquery plug-ins, just need to introduce the jquery framework and files to the jquery.barcode.js page.

<scriptType="Text/javascript"Src="Jquery.min.js"> </script> <script type=" Text/javascript "src= "Jquery.barcode.js "> </script>        

2. Define a DOM object as a container for generating barcodes/two-D codes

<div id="bcTarget"></div>

3. barcode() Draw Barcode/Two D code using jquery Selector Call method

$("#bcTarget").barcode("1234567890128", "ean13");

Generate the corresponding barcode based on the length of the input character

functionGencode(){var encode="Ean8";If(8===$("#exam_no").Text(). length) encode="Ean8";ElseIf(11===$("#exam_no").Text(). length) encode="Code11";ElseIf(13===$("#exam_no").Text(). length) encode="Ean13";$("#code_b").Barcode($("#exam_no").Text(), encode,{BarWidth:2, Barheight:50});$("#code_s").Barcode($("#exam_no").Text(){ Barwidth150}$ ( "#code_b Div" . Css ( ' Background-color '  ' #eee ' )              /span>           
Parameter description

jquery Object extension Method Barcode parameter Description:barcode: function(datas, type, settings)

2 types of datas parameters supported

  • String : The content of the barcode string to draw (depending on the type of barcode). If the barcode type can hold these characters, and there is no validation that is mandatory, the ISE of the string will be automatically calculated (original: If barcode type include it, the presence of the checksum is not mandatory, I T Ise automatically recalculated)
  • Object
    TYPE:EAN8, Ean13, Code11, Code39, code128, Codabar
    member Type
    Code String
    TYPE:STD25, Int25, Code93
    member Type
    Code String
    Crc Boolean
    Type:msi
    member Type
    Code String
    Crc Boolean
    Object Crc1:string ("Mod10", "Mod11")
    Crc2:string ("Mod10", "Mod11")
    Type:datamatrix
    member Type
    Code String
    Rect Boolean (Default:false)

type (String): barcode Type

Note to choose the encoding of the barcode according to the length of the string, the generated barcode is div+css form by default, followed by the barWidth barHeight generated parameter, the default is the 70x70 square, the parameter can adjust the bar code scale, but cannot adjust the size

    • Codabar
    • CODE11 (Code 11)
    • Code39 (Code 39)
    • Code93 (Code 93)
    • CODE128 (Code 128)
    • EAN8 (EAN 8)
    • Ean13 (EAN 13)
    • STD25 (standard 2 of 5–industrial 2 of 5)
    • Int25 (Interleaved 2 of 5)
    • Msi
    • Datamatrix (ASCII + Extended)

settings (object): barcode-style configuration

How to draw barcodes: CSS, SVG, BMP, canvas, note svg,bmp,canvas does not support IE, it is best not to
Configuration name type default value description limit
barwidth int 1 Barcode width 1 d
barheight int Container height 1 D
modulesize int 5 largeur/hauteur d ' un module 2d
showhri bool true whether to display barcode content (easy to identify)  
bgColor text #FFFFFF background color  
color text #000000 barcode color  
fontSize int Ten display barcode content font size  
output text css  
Renderer:canvas
Parameter Type Default Value Detail
PosX Int 0 X origine
PosY Int 0 Y origine
RELATED LINKS
      • Official website: http://barcode-coder.com/en/
      • GitHub Address: Https://github.com/jbdemonte/barcode

"Reprint" barcode.js powerful barcode generation jquery Plugin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.