HTML5 Adding a canvas EAN13 barcode generation Plugin Tutorial

Source: Internet
Author: User

I. Methods of Use
If you need to use the EAN13 barcode plugin as a jquery plugin, you need to introduce jquery and jquery-ean13.min.js files to the page.
<script type= "Text/javascript" src= "Js/jquery.min.js" ></script>
<script type= "Text/javascript" src= "Dist/jquery-ean13.min.js" ></script>

To invoke the EAN13 barcode via JavaScript, you need to introduce the Ean13.min.js file in the page.
<script type= "Text/javascript" src= "Dist/ean13.min.js" ></script>

Second, HTML structure
Making a EAN13 barcode requires adding a <canvas> element to the page.
<canvas id= "EAN" width= "height=" ></canvas>

If you want to change the size of the EAN13 barcode, just set the width and height of the <canvas> element.

Third, call the plug-in
The following method displays the most basic EAN13 barcodes without any parameter options:
Javascript:
var element = document.getElementById ("EAN");
New EAN13 (element, "9002236311036");

Jquery:
$ ("#EAN"). EAN13 ("9002236311036");

Four, configuration parameters
The EAN13 Barcode plugin provides some configuration parameters and callback functions that you can use to provide a single Parameter object in the second parameter when initializing the plug-in. For example:

Javascript:
var options={
Number:false,
Prefix:false,
Onsuccess:function () {
}
}
New EAN13 (document.getElementById ("EAN"), "9002236311036", options);

Jquery:
$ ("#EAN"). EAN13 ("9002236311036", {
Number:false,
Prefix:false
});

Keymob Mobile advertising platform, professional for developers to provide a stable advertising SDK, including video, interstitial, full screen and so on display mode. It also provides developers with professional services and advertising solutions that allow developers to make greater profits.

HTML5 Adding a canvas EAN13 barcode generation Plugin Tutorial

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.