GD-Barcode-1.13 > GD::Barcode::UPCA

名前

GD::Barcode::UPCA - GDでUPC-Aバーコード・イメージを作成します

概要

ex. CGI

  use GD::Barcode::UPCA;
  binmode(STDOUT);
  print "Content-Type: image/png\n\n";
  print GD::Barcode::UPCA->new('12345678901')->plot->png;

エラーチェック付き

  my $oGdBar = GD::Barcode::UPCA->new('123456789');
  die $GD::Barcode::UPCA::errStr unless($oGdBar);   #長さが不正

説明

GD::Barcode::UPCAはGD::Barcodeのサブクラスで、 GDでUPC-Aバーコードイメージを作成することを可能にします。 このモジュールは"Generate Barcode Ver 1.02 By Shisei Hanai 97/08/22"を ベースにしています。

new

$oGdBar = GD::Barcode::UPCA->new($sTxt);

コンストラクタ。 $sTxtのためのGD::Barcode::UPCA のオブジェクトを作成します。 $sTxtは11あるいは12桁の数字([0-9])です。 もし$sTxtが11桁であれば、あなたに代わってCDを計算します。

plot()

$oGd = $oGdBar->plot([Height => $iHeight, NoText => 0 | 1]);

newメソッドで指定された$sTxtのバーコードイメージを持った GDオブジェクトを作成します。$iHeightはイメージの高さです。 もしNoTextが1であればイメージには$sTxtのテキストのイメージは入りません。

 例.
  my $oGdB = GD::Barcode::UPCA->new('12345678901');
  my $oGD = $oGdB->plot(NoText=>1, Height => 20);
  # $sGDはHeight=>20ピクセルでテキストなしのGDイメージになります

barcode()

$sPtn = $oGdBar->barcode();

'1'と'0'の文字列でバーコードのパターン返します。 '1'は黒、'0'は白を意味します。

 例.
  my $oGdB = GD::Barcode::UPCA->new('12345678901');
  my $sPtn = $oGdB->barcode();
  # $sPtn = '';

$errStr

$GD::Barcode::UPCA::errStr

エラーメッセージが入ります。

$text

$oGdBar->{$text}

newメソッドで指定された$sTxtをベースにしたバーコードのテキストが入ります。

作者

川合孝典 GCD00051@nifty.ne.jp

著作権(COPYRIGHT)

The GD::Barocde::UPCA module is Copyright (c) 2000 Kawai Takanori. Japan. All rights reserved.

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

参考資料

GD::Barcode