|
Lines 7-12
use Text::Wrap qw( wrap );
Link Here
|
| 7 |
use Algorithm::CheckDigits qw( CheckDigits ); |
7 |
use Algorithm::CheckDigits qw( CheckDigits ); |
| 8 |
use Text::CSV_XS; |
8 |
use Text::CSV_XS; |
| 9 |
use Text::Bidi qw( log2vis ); |
9 |
use Text::Bidi qw( log2vis ); |
|
|
10 |
use GD::Barcode::Code39; |
| 10 |
|
11 |
|
| 11 |
use C4::Context; |
12 |
use C4::Context; |
| 12 |
use C4::Biblio qw( GetMarcFromKohaField ); |
13 |
use C4::Biblio qw( GetMarcFromKohaField ); |
|
Lines 526-534
sub barcode {
Link Here
|
| 526 |
my $hide_text = 'yes'; |
527 |
my $hide_text = 'yes'; |
| 527 |
|
528 |
|
| 528 |
if ( $params{'barcode_type'} =~ m/CODE39/ ) { |
529 |
if ( $params{'barcode_type'} =~ m/CODE39/ ) { |
| 529 |
$bar_length = '17.5'; |
|
|
| 530 |
$tot_bar_length = ( $bar_length * $num_of_bars ) + ( $guard_length * 2 ); |
| 531 |
$x_scale_factor = ( $params{'width'} / $tot_bar_length ); |
| 532 |
if ( $params{'barcode_type'} eq 'CODE39MOD' ) { |
530 |
if ( $params{'barcode_type'} eq 'CODE39MOD' ) { |
| 533 |
my $c39 = CheckDigits('code_39'); # get modulo43 checksum |
531 |
my $c39 = CheckDigits('code_39'); # get modulo43 checksum |
| 534 |
$params{'barcode_data'} = $c39->complete( $params{'barcode_data'} ); |
532 |
$params{'barcode_data'} = $c39->complete( $params{'barcode_data'} ); |
|
Lines 538-543
sub barcode {
Link Here
|
| 538 |
$hide_text = ''; |
536 |
$hide_text = ''; |
| 539 |
} |
537 |
} |
| 540 |
eval { |
538 |
eval { |
|
|
539 |
#NOTE: Barcode length algorithm comes from PDF::Reuse::Barcode |
| 540 |
#NOTE: 20 is arbitrary padding added to the barcode background by PDF::Reuse::Barcode |
| 541 |
my $oGdB = GD::Barcode::Code39->new("*$params{'barcode_data'}*"); |
| 542 |
my $whole_barcode_length = ( length( $oGdB->barcode() ) * 0.9 ) + 20; |
| 543 |
$x_scale_factor = ( $params{'width'} / $whole_barcode_length ); |
| 541 |
PDF::Reuse::Barcode::Code39( |
544 |
PDF::Reuse::Barcode::Code39( |
| 542 |
x => $params{'llx'}, |
545 |
x => $params{'llx'}, |
| 543 |
y => $params{'lly'}, |
546 |
y => $params{'lly'}, |
| 544 |
- |
|
|