NAME
HTML::Barcode::Code128 - Generate HTML representations of Code 128 barcodes
SYNOPSIS
Barcode::Code128 is required by this class, so please install it first.
my $code = HTML::Barcode::Code128->new(text => 'MONKEY');
print $code->render;
DESCRIPTION
This class allows you easily create HTML representations of Code 128 barcodes.
Here is an example of a Code 128 barcode rendered with this module:
MONKEY |
This requires Barcode::Code128. You may also use the character constants from this module in your text. Be sure to provide their full package name. For example:
my $text = Barcode::Code128::FNC1 . '00000123455555555558';
HTML::Barcode::Code128->new(text => $text)->render;
You can read more about Code 128 online (e.g. http://en.wikipedia.org/wiki/Code_128).
METHODS
new (%attributes)
Instantiate a new HTML::Barcode::Code128 object. The %attributes
hash requires the "text" attribute, and can take any of the other attributes listed below.
render
This is a convenience routine which returns <style>...</style>
tags and the rendered barcode.
If you are printing multiple barcodes or want to ensure your style
tags are in your HTML headers, then you probably want to output the barcode and style separately with "render_barcode" and "css".
render_barcode
Returns only the rendered barcode. You will need to provide stylesheets separately, either writing them yourself or using the output of "css".
css
Returns CSS needed to properly display your rendered barcode. This is only necessary if you are using "render_barcode" instead of the easier "render" method.
ATTRIBUTES
These attributes can be passed to new, or used as accessors.
text
Required - The information to put into the barcode.
foreground_color
A CSS color value (e.g. '#000' or 'black') for the foreground. Default is '#000'.
background_color
A CSS color value background. Default is '#fff'.
bar_width
A CSS value for the width of an individual bar. Default is '2px'.
bar_height
A CSS value for the height of an individual bar. Default is '100px'.
show_text
Boolean, default true. Indicates whether or not to render the text below the barcode.
css_class
The value for the class
attribute applied to any container tags in the HTML (e.g. table
or div
). td
tags within the table will have either css_class_on or css_class_off classes applied to them.
For example, if css_class is "barcode", you will get <table class="barcode">
and its cells will be either <td class="barcode_on">
or <td class="barcode_off">
.
AUTHOR
Mark A. Stratman, <stratman@gmail.com>
SOURCE REPOSITORY
http://github.com/mstratman/HTML-Barcode
SEE ALSO
LICENSE AND COPYRIGHT
Copyright 2011 Mark A. Stratman.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.