| 1 | package PDF::Reuse::Barcode; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use PDF::Reuse; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | 1 | our $VERSION = '0.09'; | |||||||||||||
| 9 | |||||||||||||||
| 10 | 1 | my ($str, $xsize, $ysize, $height, $sPtn, @sizes, $length, $value, %default); | |||||||||||||
| 11 | 1 | my $qrcode = 0; | |||||||||||||
| 12 | |||||||||||||||
| 13 | sub init | ||||||||||||||
| 14 | 0 | ▶ | { %default = ( value => '0000000', | ||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 15 | x => 0, | ||||||||||||||
| 16 | y => 0, | ||||||||||||||
| 17 | size => 1, | ||||||||||||||
| 18 | xsize => 1, | ||||||||||||||
| 19 | ysize => 1, | ||||||||||||||
| 20 | rotate => 0, | ||||||||||||||
| 21 | background => '1 1 1', | ||||||||||||||
| 22 | graybackground => 1, | ||||||||||||||
| 23 | drawbackground => 1, | ||||||||||||||
| 24 | text => 'yes', | ||||||||||||||
| 25 | prolong => 0, | ||||||||||||||
| 26 | hide_asterisk => 0, | ||||||||||||||
| 27 | modulesize => 1, | ||||||||||||||
| 28 | qr_ecc => 'M', | ||||||||||||||
| 29 | qr_version => 1, | ||||||||||||||
| 30 | qr_padding => 0, | ||||||||||||||
| 31 | mode => 'graphic'); | ||||||||||||||
| 32 | 0 | $str = ''; | |||||||||||||
| 33 | 0 | $xsize = 1; | |||||||||||||
| 34 | 0 | $ysize = 1; | |||||||||||||
| 35 | 0 | $height = 37; | |||||||||||||
| 36 | 0 | $sPtn = ''; | |||||||||||||
| 37 | 0 | @sizes = (); | |||||||||||||
| 38 | 0 | $length = 0; | |||||||||||||
| 39 | 0 | $value = '' | |||||||||||||
| 40 | } | ||||||||||||||
| 41 | |||||||||||||||
| 42 | |||||||||||||||
| 43 | sub general1 | ||||||||||||||
| 44 | 0 | ▶ | { $default{'xsize'} = 1 unless ($default{'xsize'} != 0); | ||||||||||||
|
Subroutine
general1: not called CC=5 SCAR=34.0
Pod
undocumented
Branch: 1 branch
| |||||||||||||||
| 45 | 0 | ▶ | $default{'ysize'} = 1 unless ($default{'ysize'} != 0); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 46 | 0 | ▶ | $default{'size'} = 1 unless ($default{'size'} != 0); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 47 | 0 | $xsize = $default{'xsize'} * $default{'size'}; | |||||||||||||
| 48 | 0 | $ysize = $default{'ysize'} * $default{'size'}; | |||||||||||||
| 49 | 0 | $str = "q\n"; | |||||||||||||
| 50 | 0 | $str .= "$xsize 0 0 $ysize $default{'x'} $default{'y'} cm\n"; | |||||||||||||
| 51 | 0 | ▶ | if ($default{'rotate'} != 0) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 52 | 0 | { my $radian = sprintf("%.6f", $default{'rotate'} / 57.2957795); # approx. | |||||||||||||
| 53 | 0 | my $Cos = sprintf("%.6f", cos($radian)); | |||||||||||||
| 54 | 0 | my $Sin = sprintf("%.6f", sin($radian)); | |||||||||||||
| 55 | 0 | my $negSin = $Sin * -1; | |||||||||||||
| 56 | 0 | $str .= "$Cos $Sin $negSin $Cos 0 0 cm\n"; | |||||||||||||
| 57 | } | ||||||||||||||
| 58 | } | ||||||||||||||
| 59 | |||||||||||||||
| 60 | sub general2 | ||||||||||||||
| 61 | 0 | ▶ | { if ($qrcode) | ||||||||||||
|
Subroutine
general2: not called CC=8 SCAR=42.8
Pod
undocumented
Branch: 1 branch
| |||||||||||||||
| 62 | 0 | { my $m = $default{'modulesize'}; | |||||||||||||
| 63 | 0 | my @rows = split(/\n/, $sPtn); | |||||||||||||
| 64 | 0 | $length = length($rows[0]) * $m; | |||||||||||||
| 65 | 0 | $height = (1 + scalar(@rows)) * $m; | |||||||||||||
| 66 | 0 | my $step = 1; | |||||||||||||
| 67 | |||||||||||||||
| 68 | 0 | ▶ | if ($default{'drawbackground'}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 69 | 0 | { $str .= "$default{'graybackground'} g\n"; | |||||||||||||
| 70 | 0 | $str .= "0 0 $length $height re\n"; | |||||||||||||
| 71 | 0 | $str .= 'f*' . "\n"; | |||||||||||||
| 72 | 0 | $str .= "0 g\n"; | |||||||||||||
| 73 | } | ||||||||||||||
| 74 | 0 | prAdd($str); | |||||||||||||
| 75 | |||||||||||||||
| 76 | 0 | @sizes = prFontSize(12); | |||||||||||||
| 77 | |||||||||||||||
| 78 | 0 | $str = Qr( 0, $step, $sPtn); | |||||||||||||
| 79 | } | ||||||||||||||
| 80 | else | ||||||||||||||
| 81 | 0 | { $length = 20 + (length($sPtn) * 0.9); | |||||||||||||
| 82 | 0 | my $height = 38; | |||||||||||||
| 83 | 0 | my $step = 9; | |||||||||||||
| 84 | 0 | my $prolong = 0; | |||||||||||||
| 85 | 0 | ▶ | if ($default{'prolong'} > 1) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 86 | 0 | { $prolong = $default{'prolong'}; | |||||||||||||
| 87 | 0 | $height = 26 + ($prolong * 12); | |||||||||||||
| 88 | } | ||||||||||||||
| 89 | 0 | ▶ | if ($default{'drawbackground'}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 90 | 0 | { $str .= "$default{'background'} rg\n"; | |||||||||||||
| 91 | 0 | $str .= "0 0 $length $height re\n"; | |||||||||||||
| 92 | 0 | $str .= 'f*' . "\n"; | |||||||||||||
| 93 | 0 | $str .= "0 0 0 rg\n"; | |||||||||||||
| 94 | } | ||||||||||||||
| 95 | |||||||||||||||
| 96 | 0 | prAdd($str); | |||||||||||||
| 97 | |||||||||||||||
| 98 | 0 | @sizes = prFontSize(12); | |||||||||||||
| 99 | |||||||||||||||
| 100 | 0 | $str = Bar( 10, $step, $sPtn); | |||||||||||||
| 101 | |||||||||||||||
| 102 | 0 | $prolong--; | |||||||||||||
| 103 | |||||||||||||||
| 104 | 0 | ▶ | if ($prolong > 0) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 105 | 0 | { $sPtn =~ s/G/1/go; | |||||||||||||
| 106 | 0 | ▶ | while ($prolong > 0) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 107 | 0 | ▶ | { if ($prolong > 1) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 108 | 0 | { $prolong--; | |||||||||||||
| 109 | 0 | $step += 12; | |||||||||||||
| 110 | } | ||||||||||||||
| 111 | else | ||||||||||||||
| 112 | 0 | { $step += (12 * $prolong); | |||||||||||||
| 113 | 0 | $prolong = 0; | |||||||||||||
| 114 | } | ||||||||||||||
| 115 | 0 | $str .= Bar( 10, $step, $sPtn); | |||||||||||||
| 116 | } | ||||||||||||||
| 117 | } | ||||||||||||||
| 118 | } | ||||||||||||||
| 119 | |||||||||||||||
| 120 | 0 | $str .= "B\n"; | |||||||||||||
| 121 | 0 | prAdd($str); | |||||||||||||
| 122 | |||||||||||||||
| 123 | } | ||||||||||||||
| 124 | |||||||||||||||
| 125 | |||||||||||||||
| 126 | sub general3 | ||||||||||||||
| 127 | 0 | ▶ | { $str = "Q\n"; | ||||||||||||
|
Subroutine
general3: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 128 | 0 | prAdd($str); | |||||||||||||
| 129 | 0 | prFontSize($sizes[1]); | |||||||||||||
| 130 | } | ||||||||||||||
| 131 | |||||||||||||||
| 132 | sub standardEnd | ||||||||||||||
| 133 | 0 | ▶ | { general2(); | ||||||||||||
|
Subroutine
standardEnd: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||
| 134 | |||||||||||||||
| 135 | 0 | ▶ | if ($default{'text'}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 136 | 0 | { my @vec = prFont('C'); | |||||||||||||
| 137 | 0 | prFontSize(10); | |||||||||||||
| 138 | 0 | my $textLength = length($value) * 6; | |||||||||||||
| 139 | 0 | my $start = ($length - $textLength) / 2; | |||||||||||||
| 140 | 0 | ▶ | if ($qrcode) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 141 | 0 | my $quiet = sprintf("%.2f", 4 * $default{'modulesize'}); | |||||||||||||
| 142 | 0 | prText($start, 0-$quiet, $value); | |||||||||||||
| 143 | } | ||||||||||||||
| 144 | else { | ||||||||||||||
| 145 | 0 | prText($start, 1.5, $value); | |||||||||||||
| 146 | } | ||||||||||||||
| 147 | 0 | prFont($vec[3]); | |||||||||||||
| 148 | } | ||||||||||||||
| 149 | 0 | general3(); | |||||||||||||
| 150 | |||||||||||||||
| 151 | 0 | 1; | |||||||||||||
| 152 | } | ||||||||||||||
| 153 | |||||||||||||||
| 154 | sub Bar | ||||||||||||||
| 155 | 0 | ▶ | { my ($x, $y, $pattern) = @_; | ||||||||||||
|
Subroutine
Bar: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||
| 156 | 0 | my $yEnd = $y + 20; | |||||||||||||
| 157 | 0 | my $yG = $y - 3; | |||||||||||||
| 158 | |||||||||||||||
| 159 | 0 | my $string = "0.92 w\n 0 0 0 RG\n"; | |||||||||||||
| 160 | 0 | for (split(//, $pattern)) | |||||||||||||
| 161 | 0 | ▶ | { if ($_ eq '1') | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 162 | 0 | { $string .= "$x $yEnd m\n $x $y l\n"; | |||||||||||||
| 163 | } | ||||||||||||||
| 164 | elsif($_ eq 'G') | ||||||||||||||
| 165 | 0 | { $string .= "$x $yEnd m\n $x $yG l\n"; | |||||||||||||
| 166 | } | ||||||||||||||
| 167 | 0 | $x = sprintf("%.2f", $x + 0.91); | |||||||||||||
| 168 | } | ||||||||||||||
| 169 | 0 | return $string; | |||||||||||||
| 170 | } | ||||||||||||||
| 171 | |||||||||||||||
| 172 | |||||||||||||||
| 173 | sub Qr | ||||||||||||||
| 174 | 0 | ▶ | { my ($x, $y, $pattern) = @_; | ||||||||||||
|
Subroutine
Qr: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||
| 175 | 0 | my $xStart = sprintf("%.2f", $x); | |||||||||||||
| 176 | |||||||||||||||
| 177 | 0 | my $m = $default{'modulesize'}; | |||||||||||||
| 178 | 0 | my $s = $default{'qr_padding'}; | |||||||||||||
| 179 | 0 | my $space = sprintf('%.2f', $m + $s);# | |||||||||||||
| 180 | |||||||||||||||
| 181 | 0 | my $string = "0.01 w\n 0 G\n"; | |||||||||||||
| 182 | 0 | my @rows = split(/\n/, $pattern); | |||||||||||||
| 183 | 0 | for my $row (reverse @rows) { | |||||||||||||
| 184 | 0 | my $yEnd = sprintf("%.2f", $y + $m); | |||||||||||||
| 185 | 0 | for (split(//, $row)) | |||||||||||||
| 186 | 0 | { my $xEnd = sprintf("%.2f", $x + $m); | |||||||||||||
| 187 | 0 | ▶ | if ($_ eq '1') | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 188 | 0 | { $string .= "$x $y $m $m re\nf\n"; | |||||||||||||
| 189 | } | ||||||||||||||
| 190 | 0 | $x = sprintf("%.2f", $x + $space); | |||||||||||||
| 191 | } | ||||||||||||||
| 192 | 0 | $x = $xStart; | |||||||||||||
| 193 | 0 | $y = sprintf("%.2f", $y + $space); | |||||||||||||
| 194 | } | ||||||||||||||
| 195 | 0 | return $string; | |||||||||||||
| 196 | } | ||||||||||||||
| 197 | |||||||||||||||
| 198 | sub Code128 | ||||||||||||||
| 199 | 0 | ▶ | { eval 'require Barcode::Code128'; | ||||||||||||
|
Subroutine
Code128: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 200 | 0 | init(); | |||||||||||||
| 201 | 0 | my %param = @_; | |||||||||||||
| 202 | 0 | for (keys %param) | |||||||||||||
| 203 | 0 | { my $lc = lc($_); | |||||||||||||
| 204 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 205 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 206 | } | ||||||||||||||
| 207 | else | ||||||||||||||
| 208 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 209 | } | ||||||||||||||
| 210 | } | ||||||||||||||
| 211 | 0 | $value = $default{'value'}; | |||||||||||||
| 212 | |||||||||||||||
| 213 | 0 | general1(); | |||||||||||||
| 214 | |||||||||||||||
| 215 | 0 | my $oGDBar = Barcode::Code128->new(); | |||||||||||||
| 216 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 217 | 0 | { die "The translation of $value to barcodes didn't succeed, aborts\n"; | |||||||||||||
| 218 | } | ||||||||||||||
| 219 | else | ||||||||||||||
| 220 | { | ||||||||||||||
| 221 | 0 | $sPtn = $oGDBar->barcode($value); | |||||||||||||
| 222 | 0 | $sPtn =~ tr/#/1/; | |||||||||||||
| 223 | 0 | $sPtn =~ tr/ /0/; | |||||||||||||
| 224 | } | ||||||||||||||
| 225 | 0 | standardEnd(); | |||||||||||||
| 226 | 0 | 1; | |||||||||||||
| 227 | } | ||||||||||||||
| 228 | |||||||||||||||
| 229 | |||||||||||||||
| 230 | sub Code39 | ||||||||||||||
| 231 | 0 | ▶ | { eval 'require GD::Barcode::Code39'; | ||||||||||||
|
Subroutine
Code39: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||
| 232 | 0 | init(); | |||||||||||||
| 233 | 0 | my %param = @_; | |||||||||||||
| 234 | 0 | for (keys %param) | |||||||||||||
| 235 | 0 | { my $lc = lc($_); | |||||||||||||
| 236 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 237 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 238 | } | ||||||||||||||
| 239 | else | ||||||||||||||
| 240 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 241 | } | ||||||||||||||
| 242 | } | ||||||||||||||
| 243 | 0 | $value = $default{'value'}; | |||||||||||||
| 244 | |||||||||||||||
| 245 | 0 | general1(); | |||||||||||||
| 246 | |||||||||||||||
| 247 | 0 | my $oGDBar = GD::Barcode::Code39->new($value); | |||||||||||||
| 248 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 249 | 0 | { die "$GD::Barcode::Code39::errStr\n"; | |||||||||||||
| 250 | } | ||||||||||||||
| 251 | else | ||||||||||||||
| 252 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 253 | } | ||||||||||||||
| 254 | 0 | ▶ | if ($default{hide_asterisk}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 255 | 0 | { $value =~ s/^\*//; | |||||||||||||
| 256 | 0 | $value =~ s/\*$//; | |||||||||||||
| 257 | } | ||||||||||||||
| 258 | 0 | standardEnd(); | |||||||||||||
| 259 | 0 | 1; | |||||||||||||
| 260 | } | ||||||||||||||
| 261 | |||||||||||||||
| 262 | sub COOP2of5 | ||||||||||||||
| 263 | 0 | ▶ | { eval 'require GD::Barcode::COOP2of5'; | ||||||||||||
|
Subroutine
COOP2of5: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 264 | 0 | init(); | |||||||||||||
| 265 | 0 | my %param = @_; | |||||||||||||
| 266 | 0 | for (keys %param) | |||||||||||||
| 267 | 0 | { my $lc = lc($_); | |||||||||||||
| 268 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 269 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 270 | } | ||||||||||||||
| 271 | else | ||||||||||||||
| 272 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 273 | } | ||||||||||||||
| 274 | } | ||||||||||||||
| 275 | 0 | $value = $default{'value'}; | |||||||||||||
| 276 | |||||||||||||||
| 277 | 0 | general1(); | |||||||||||||
| 278 | |||||||||||||||
| 279 | 0 | my $oGDBar = GD::Barcode::COOP2of5->new($value); | |||||||||||||
| 280 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 281 | 0 | { die "$GD::Barcode::COOP2of5::errStr\n"; | |||||||||||||
| 282 | } | ||||||||||||||
| 283 | else | ||||||||||||||
| 284 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 285 | } | ||||||||||||||
| 286 | |||||||||||||||
| 287 | 0 | standardEnd(); | |||||||||||||
| 288 | 0 | 1; | |||||||||||||
| 289 | } | ||||||||||||||
| 290 | |||||||||||||||
| 291 | sub IATA2of5 | ||||||||||||||
| 292 | 0 | ▶ | { eval 'require GD::Barcode::IATA2of5'; | ||||||||||||
|
Subroutine
IATA2of5: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 293 | 0 | init(); | |||||||||||||
| 294 | 0 | my %param = @_; | |||||||||||||
| 295 | 0 | for (keys %param) | |||||||||||||
| 296 | 0 | { my $lc = lc($_); | |||||||||||||
| 297 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 298 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 299 | } | ||||||||||||||
| 300 | else | ||||||||||||||
| 301 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 302 | } | ||||||||||||||
| 303 | } | ||||||||||||||
| 304 | 0 | $value = $default{'value'}; | |||||||||||||
| 305 | |||||||||||||||
| 306 | 0 | general1(); | |||||||||||||
| 307 | |||||||||||||||
| 308 | 0 | my $oGDBar = GD::Barcode::IATA2of5->new($value); | |||||||||||||
| 309 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 310 | 0 | { die "$GD::Barcode::IATA2of5::errStr\n"; | |||||||||||||
| 311 | } | ||||||||||||||
| 312 | else | ||||||||||||||
| 313 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 314 | } | ||||||||||||||
| 315 | |||||||||||||||
| 316 | 0 | standardEnd(); | |||||||||||||
| 317 | 0 | 1; | |||||||||||||
| 318 | |||||||||||||||
| 319 | } | ||||||||||||||
| 320 | |||||||||||||||
| 321 | sub Industrial2of5 | ||||||||||||||
| 322 | 0 | ▶ | { eval 'require GD::Barcode::Industrial2of5'; | ||||||||||||
|
Subroutine
Industrial2of5: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 323 | 0 | init(); | |||||||||||||
| 324 | 0 | my %param = @_; | |||||||||||||
| 325 | 0 | for (keys %param) | |||||||||||||
| 326 | 0 | { my $lc = lc($_); | |||||||||||||
| 327 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 328 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 329 | } | ||||||||||||||
| 330 | else | ||||||||||||||
| 331 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 332 | } | ||||||||||||||
| 333 | } | ||||||||||||||
| 334 | 0 | $value = $default{'value'}; | |||||||||||||
| 335 | |||||||||||||||
| 336 | 0 | general1(); | |||||||||||||
| 337 | |||||||||||||||
| 338 | 0 | my $oGDBar = GD::Barcode::Industrial2of5->new($value); | |||||||||||||
| 339 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 340 | 0 | { die "$GD::Barcode::Industrial2of5::errStr\n"; | |||||||||||||
| 341 | } | ||||||||||||||
| 342 | else | ||||||||||||||
| 343 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 344 | } | ||||||||||||||
| 345 | |||||||||||||||
| 346 | 0 | standardEnd(); | |||||||||||||
| 347 | 0 | 1; | |||||||||||||
| 348 | } | ||||||||||||||
| 349 | |||||||||||||||
| 350 | sub Matrix2of5 | ||||||||||||||
| 351 | 0 | ▶ | { eval 'require GD::Barcode::Matrix2of5'; | ||||||||||||
|
Subroutine
Matrix2of5: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 352 | 0 | init(); | |||||||||||||
| 353 | 0 | my %param = @_; | |||||||||||||
| 354 | 0 | for (keys %param) | |||||||||||||
| 355 | 0 | { my $lc = lc($_); | |||||||||||||
| 356 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 357 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 358 | } | ||||||||||||||
| 359 | else | ||||||||||||||
| 360 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 361 | } | ||||||||||||||
| 362 | } | ||||||||||||||
| 363 | 0 | $value = $default{'value'}; | |||||||||||||
| 364 | |||||||||||||||
| 365 | 0 | general1(); | |||||||||||||
| 366 | |||||||||||||||
| 367 | 0 | my $oGDBar = GD::Barcode::Matrix2of5->new($value); | |||||||||||||
| 368 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 369 | 0 | { die "$GD::Barcode::Matrix2of5::errStr\n"; | |||||||||||||
| 370 | } | ||||||||||||||
| 371 | else | ||||||||||||||
| 372 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 373 | } | ||||||||||||||
| 374 | |||||||||||||||
| 375 | 0 | standardEnd(); | |||||||||||||
| 376 | 0 | 1; | |||||||||||||
| 377 | } | ||||||||||||||
| 378 | |||||||||||||||
| 379 | sub NW7 | ||||||||||||||
| 380 | 0 | ▶ | { eval 'require GD::Barcode::NW7'; | ||||||||||||
|
Subroutine
NW7: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 381 | 0 | init(); | |||||||||||||
| 382 | 0 | my %param = @_; | |||||||||||||
| 383 | 0 | for (keys %param) | |||||||||||||
| 384 | 0 | { my $lc = lc($_); | |||||||||||||
| 385 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 386 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 387 | } | ||||||||||||||
| 388 | else | ||||||||||||||
| 389 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 390 | } | ||||||||||||||
| 391 | } | ||||||||||||||
| 392 | 0 | $value = $default{'value'}; | |||||||||||||
| 393 | |||||||||||||||
| 394 | 0 | general1(); | |||||||||||||
| 395 | |||||||||||||||
| 396 | 0 | my $oGDBar = GD::Barcode::NW7->new($value); | |||||||||||||
| 397 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 398 | 0 | { die "$GD::Barcode::NW7::errStr\n"; | |||||||||||||
| 399 | } | ||||||||||||||
| 400 | else | ||||||||||||||
| 401 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 402 | } | ||||||||||||||
| 403 | |||||||||||||||
| 404 | 0 | standardEnd(); | |||||||||||||
| 405 | 0 | 1; | |||||||||||||
| 406 | } | ||||||||||||||
| 407 | |||||||||||||||
| 408 | |||||||||||||||
| 409 | |||||||||||||||
| 410 | sub EAN13 | ||||||||||||||
| 411 | 0 | ▶ | { eval 'require GD::Barcode::EAN13'; | ||||||||||||
|
Subroutine
EAN13: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||
| 412 | 0 | init(); | |||||||||||||
| 413 | 0 | my %param = @_; | |||||||||||||
| 414 | 0 | for (keys %param) | |||||||||||||
| 415 | 0 | { my $lc = lc($_); | |||||||||||||
| 416 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 417 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 418 | } | ||||||||||||||
| 419 | else | ||||||||||||||
| 420 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 421 | } | ||||||||||||||
| 422 | } | ||||||||||||||
| 423 | 0 | $value = $default{'value'}; | |||||||||||||
| 424 | |||||||||||||||
| 425 | 0 | general1(); | |||||||||||||
| 426 | |||||||||||||||
| 427 | 0 | ▶ | if ($value =~ m'([^0-9]+)'o) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 428 | 0 | { die "Invalid character $1, aborts\n"; | |||||||||||||
| 429 | } | ||||||||||||||
| 430 | |||||||||||||||
| 431 | 0 | ▶ | if (length($value) == 12) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 432 | 0 | { $value .= GD::Barcode::EAN13::calcEAN13CD($value); | |||||||||||||
| 433 | } | ||||||||||||||
| 434 | 0 | my $oGDBar = GD::Barcode::EAN13->new($value); | |||||||||||||
| 435 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 436 | 0 | { die "$GD::Barcode::EAN13::errStr\n"; | |||||||||||||
| 437 | } | ||||||||||||||
| 438 | else | ||||||||||||||
| 439 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 440 | } | ||||||||||||||
| 441 | 0 | general2(); | |||||||||||||
| 442 | |||||||||||||||
| 443 | 0 | ▶ | if ($default{'text'}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 444 | 0 | { my $siffra = substr($value, 0, 1); | |||||||||||||
| 445 | 0 | my $del1 = substr($value, 1, 6); | |||||||||||||
| 446 | 0 | my $del2 = substr($value, 7, 6); | |||||||||||||
| 447 | |||||||||||||||
| 448 | 0 | my @vec = prFont('C'); | |||||||||||||
| 449 | |||||||||||||||
| 450 | 0 | prFontSize(10); | |||||||||||||
| 451 | |||||||||||||||
| 452 | 0 | prText(1, 2, $siffra); | |||||||||||||
| 453 | 0 | prText(14, 2, $del1); | |||||||||||||
| 454 | 0 | prText(56, 2, $del2); | |||||||||||||
| 455 | |||||||||||||||
| 456 | 0 | prFont($vec[3]); | |||||||||||||
| 457 | } | ||||||||||||||
| 458 | 0 | general3; | |||||||||||||
| 459 | 0 | 1; | |||||||||||||
| 460 | } | ||||||||||||||
| 461 | |||||||||||||||
| 462 | sub EAN8 | ||||||||||||||
| 463 | 0 | ▶ | { eval 'require GD::Barcode::EAN8'; | ||||||||||||
|
Subroutine
EAN8: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||
| 464 | 0 | init(); | |||||||||||||
| 465 | 0 | my %param = @_; | |||||||||||||
| 466 | 0 | for (keys %param) | |||||||||||||
| 467 | 0 | { my $lc = lc($_); | |||||||||||||
| 468 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 469 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 470 | } | ||||||||||||||
| 471 | else | ||||||||||||||
| 472 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 473 | } | ||||||||||||||
| 474 | } | ||||||||||||||
| 475 | 0 | $value = $default{'value'}; | |||||||||||||
| 476 | |||||||||||||||
| 477 | 0 | general1(); | |||||||||||||
| 478 | |||||||||||||||
| 479 | 0 | ▶ | if ($value =~ m'([^0-9]+)'o) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 480 | 0 | { die "Invalid character $1, aborts\n"; | |||||||||||||
| 481 | } | ||||||||||||||
| 482 | |||||||||||||||
| 483 | 0 | ▶ | if (length($value) == 7) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 484 | 0 | { $value .= GD::Barcode::EAN8::calcEAN8CD($value); | |||||||||||||
| 485 | } | ||||||||||||||
| 486 | 0 | my $oGDBar = GD::Barcode::EAN8->new($value); | |||||||||||||
| 487 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 488 | 0 | { die "$GD::Barcode::EAN8::errStr\n"; | |||||||||||||
| 489 | } | ||||||||||||||
| 490 | else | ||||||||||||||
| 491 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 492 | } | ||||||||||||||
| 493 | 0 | general2(); | |||||||||||||
| 494 | |||||||||||||||
| 495 | 0 | ▶ | if ($default{'text'}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 496 | 0 | { my $del1 = substr($value, 0, 4); | |||||||||||||
| 497 | 0 | my $del2 = substr($value, 4, 4); | |||||||||||||
| 498 | 0 | my @vec = prFont('C'); | |||||||||||||
| 499 | 0 | prFontSize(10); | |||||||||||||
| 500 | 0 | prText(14, 2, $del1); | |||||||||||||
| 501 | 0 | prText(42.5, 2, $del2); | |||||||||||||
| 502 | 0 | prFont($vec[3]); | |||||||||||||
| 503 | } | ||||||||||||||
| 504 | 0 | general3; | |||||||||||||
| 505 | 0 | 1; | |||||||||||||
| 506 | } | ||||||||||||||
| 507 | |||||||||||||||
| 508 | sub ITF | ||||||||||||||
| 509 | 0 | ▶ | { eval 'require GD::Barcode::ITF'; | ||||||||||||
|
Subroutine
ITF: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 510 | 0 | init(); | |||||||||||||
| 511 | 0 | my %param = @_; | |||||||||||||
| 512 | 0 | for (keys %param) | |||||||||||||
| 513 | 0 | { my $lc = lc($_); | |||||||||||||
| 514 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 515 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 516 | } | ||||||||||||||
| 517 | else | ||||||||||||||
| 518 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 519 | } | ||||||||||||||
| 520 | } | ||||||||||||||
| 521 | 0 | $value = $default{'value'}; | |||||||||||||
| 522 | |||||||||||||||
| 523 | 0 | general1(); | |||||||||||||
| 524 | |||||||||||||||
| 525 | 0 | my $oGDBar = GD::Barcode::ITF->new($value); | |||||||||||||
| 526 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 527 | 0 | { die "$GD::Barcode::ITF::errStr\n"; | |||||||||||||
| 528 | } | ||||||||||||||
| 529 | else | ||||||||||||||
| 530 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 531 | } | ||||||||||||||
| 532 | |||||||||||||||
| 533 | 0 | standardEnd(); | |||||||||||||
| 534 | 0 | 1; | |||||||||||||
| 535 | } | ||||||||||||||
| 536 | |||||||||||||||
| 537 | sub UPCA | ||||||||||||||
| 538 | 0 | ▶ | { eval 'require GD::Barcode::UPCA'; | ||||||||||||
|
Subroutine
UPCA: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||
| 539 | 0 | init(); | |||||||||||||
| 540 | 0 | my %param = @_; | |||||||||||||
| 541 | 0 | for (keys %param) | |||||||||||||
| 542 | 0 | { my $lc = lc($_); | |||||||||||||
| 543 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 544 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 545 | } | ||||||||||||||
| 546 | else | ||||||||||||||
| 547 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 548 | } | ||||||||||||||
| 549 | } | ||||||||||||||
| 550 | 0 | $value = $default{'value'}; | |||||||||||||
| 551 | |||||||||||||||
| 552 | 0 | general1(); | |||||||||||||
| 553 | |||||||||||||||
| 554 | 0 | ▶ | if ($value =~ m'([^0-9]+)'o) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 555 | 0 | { die "Invalid character $1, aborts\n"; | |||||||||||||
| 556 | } | ||||||||||||||
| 557 | |||||||||||||||
| 558 | 0 | ▶ | if (length($value) == 11) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 559 | 0 | { $value .= GD::Barcode::UPCA::calcUPCACD($value); | |||||||||||||
| 560 | } | ||||||||||||||
| 561 | 0 | my $oGDBar = GD::Barcode::UPCA->new($value); | |||||||||||||
| 562 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 563 | 0 | { die "$GD::Barcode::UPCA::errStr\n"; | |||||||||||||
| 564 | } | ||||||||||||||
| 565 | else | ||||||||||||||
| 566 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 567 | } | ||||||||||||||
| 568 | 0 | general2(); | |||||||||||||
| 569 | |||||||||||||||
| 570 | 0 | ▶ | if ($default{'text'}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 571 | 0 | { my $siffra1 = substr($value, 0, 1); | |||||||||||||
| 572 | 0 | my $del1 = substr($value, 1, 5); | |||||||||||||
| 573 | 0 | my $del2 = substr($value, 6, 5); | |||||||||||||
| 574 | 0 | my $siffra2 = substr($value, 11, 1); | |||||||||||||
| 575 | |||||||||||||||
| 576 | 0 | my @vec = prFont('C'); | |||||||||||||
| 577 | |||||||||||||||
| 578 | 0 | prFontSize(10); | |||||||||||||
| 579 | |||||||||||||||
| 580 | 0 | prText(2, 2, $siffra1); | |||||||||||||
| 581 | 0 | prText(20, 2, $del1); | |||||||||||||
| 582 | 0 | prText(56, 2, $del2); | |||||||||||||
| 583 | 0 | prText(97, 2, $siffra2); | |||||||||||||
| 584 | |||||||||||||||
| 585 | 0 | prFont($vec[3]); | |||||||||||||
| 586 | } | ||||||||||||||
| 587 | 0 | general3; | |||||||||||||
| 588 | 0 | 1; | |||||||||||||
| 589 | } | ||||||||||||||
| 590 | |||||||||||||||
| 591 | sub UPCE | ||||||||||||||
| 592 | 0 | ▶ | { eval 'require GD::Barcode::UPCE'; | ||||||||||||
|
Subroutine
UPCE: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||
| 593 | 0 | init(); | |||||||||||||
| 594 | 0 | my %param = @_; | |||||||||||||
| 595 | 0 | for (keys %param) | |||||||||||||
| 596 | 0 | { my $lc = lc($_); | |||||||||||||
| 597 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 598 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 599 | } | ||||||||||||||
| 600 | else | ||||||||||||||
| 601 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 602 | } | ||||||||||||||
| 603 | } | ||||||||||||||
| 604 | 0 | $value = $default{'value'}; | |||||||||||||
| 605 | |||||||||||||||
| 606 | 0 | general1(); | |||||||||||||
| 607 | |||||||||||||||
| 608 | 0 | ▶ | if ($value =~ m'([^0-9]+)'o) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 609 | 0 | { die "Invalid character $1, aborts\n"; | |||||||||||||
| 610 | } | ||||||||||||||
| 611 | |||||||||||||||
| 612 | 0 | ▶ | if (length($value) == 6) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 613 | 0 | { $value = '0' . $value; | |||||||||||||
| 614 | 0 | my $cd = GD::Barcode::UPCE::calcUPCECD($value); | |||||||||||||
| 615 | 0 | $value .= $cd; | |||||||||||||
| 616 | } | ||||||||||||||
| 617 | elsif (length($value) == 7) | ||||||||||||||
| 618 | 0 | { my $cd = GD::Barcode::UPCE::calcUPCECD($value); | |||||||||||||
| 619 | 0 | $value .= $cd; | |||||||||||||
| 620 | } | ||||||||||||||
| 621 | 0 | my $oGDBar = GD::Barcode::UPCE->new($value); | |||||||||||||
| 622 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 623 | 0 | { die "$GD::Barcode::UPCE::errStr\n"; | |||||||||||||
| 624 | } | ||||||||||||||
| 625 | else | ||||||||||||||
| 626 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 627 | } | ||||||||||||||
| 628 | 0 | general2(); | |||||||||||||
| 629 | |||||||||||||||
| 630 | 0 | ▶ | if ($default{'text'}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 631 | 0 | { my $siffra = substr($value, 0, 1); | |||||||||||||
| 632 | 0 | my $del1 = substr($value, 1, 6); | |||||||||||||
| 633 | 0 | my $del2 = substr($value, 7, 1); | |||||||||||||
| 634 | |||||||||||||||
| 635 | 0 | my @vec = prFont('C'); | |||||||||||||
| 636 | |||||||||||||||
| 637 | 0 | prFontSize(10); | |||||||||||||
| 638 | |||||||||||||||
| 639 | 0 | prText(2, 2, $siffra); | |||||||||||||
| 640 | 0 | prText(14, 2, $del1); | |||||||||||||
| 641 | 0 | prText(58, 2, $del2); | |||||||||||||
| 642 | |||||||||||||||
| 643 | 0 | prFont($vec[3]); | |||||||||||||
| 644 | } | ||||||||||||||
| 645 | 0 | general3; | |||||||||||||
| 646 | 0 | 1; | |||||||||||||
| 647 | } | ||||||||||||||
| 648 | |||||||||||||||
| 649 | sub QRcode | ||||||||||||||
| 650 | 0 | ▶ | { eval 'require GD::Barcode::QRcode'; | ||||||||||||
|
Subroutine
QRcode: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||
| 651 | 0 | $qrcode = 1; | |||||||||||||
| 652 | 0 | init(); | |||||||||||||
| 653 | 0 | my %param = @_; | |||||||||||||
| 654 | 0 | for (keys %param) | |||||||||||||
| 655 | 0 | { my $lc = lc($_); | |||||||||||||
| 656 | 0 | ▶ | if (exists $default{$lc}) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 657 | 0 | { $default{$lc} = $param{$_}; | |||||||||||||
| 658 | } | ||||||||||||||
| 659 | else | ||||||||||||||
| 660 | 0 | { print STDERR "Unknown parameter $_ , not used \n"; | |||||||||||||
| 661 | } | ||||||||||||||
| 662 | } | ||||||||||||||
| 663 | 0 | $value = $default{'value'}; | |||||||||||||
| 664 | |||||||||||||||
| 665 | 0 | general1(); | |||||||||||||
| 666 | |||||||||||||||
| 667 | 0 | my $oGDBar = GD::Barcode::QRcode->new($value, {Ecc => $default{'qr_ecc'}, Version=>$default{'qr_version'}, ModuleSize => $default{'size'}}); | |||||||||||||
| 668 | 0 | ▶ | if (! $oGDBar) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 669 | 0 | { die "$GD::Barcode::QRcode::errStr\n"; | |||||||||||||
| 670 | } | ||||||||||||||
| 671 | else | ||||||||||||||
| 672 | 0 | { $sPtn = $oGDBar->barcode(); | |||||||||||||
| 673 | } | ||||||||||||||
| 674 | 0 | standardEnd(); | |||||||||||||
| 675 | 0 | 1; | |||||||||||||
| 676 | } | ||||||||||||||
| 677 | |||||||||||||||
| 678 | |||||||||||||||
| 679 | 1 | 1; | |||||||||||||
| 680 | |||||||||||||||
| 681 | |||||||||||||||
| 682 | __END__ | ||||||||||||||