The Header: Enauts Thinking!
created:Wed 01 Sep 2021
edited:Wed 01 Sep 2021
translations: english deutsch

Koha: Increase barcode size in labels

When printing the labels for books the barcode is smaller than expected. It does not cover the width of the page and is left-aligned. This is a note to my future self and maybe to someone else how the barcodesize can be increased.

Unfortunately there does not seem to be a setting to change the barcode size - so this has to be done in code.

The relevant code is in /usr/share/koha/lib/C4/Labels/Label.pm . You will find, at the lines 220-260, 4 fuctions corresponding to the print types BIB BAR BIBBAR BARBIB. Depending on what you are using you can change only that function or you just change all of them.

Those functions define a barcode width witch is multiplied by 0.8 remove that factor or adjust it to your liking. for me the resulting BIBBAR function looks like:

sub _BIBBAR {
    my $self = shift;
    my $barcode_llx = $self->{'llx'} + $self->{'left_text_margin'};
    my $barcode_lly = $self->{'lly'} + $self->{'top_text_margin'}; 
    my $barcode_width = 1.0 * $self->{'width'}; 
    my $barcode_y_scale_factor = 0.012 * $self->{'height'};
    my $line_spacer = ($self->{'font_size'} * 1); 
    my $text_lly = ($self->{'lly'} + ($self->{'height'} - $self->{'top_text_margin'}));
    $debug and warn  "Label: llx $self->{'llx'}, lly $self->{'lly'}, Text: lly $text_lly, $line_spacer, Barcode: llx $barcode_llx, lly $barcode_lly, $barcode_width, $barcode_y_scale_factor\n";
    return $self->{'llx'}, $text_lly, $line_spacer, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor;
}

Comments

created:Tue 01 Feb 2022
edited:Wed 02 Feb 2022

ABID

How to adjust font size of the barcode number that just below to the bar line.

created:Wed 02 Feb 2022
edited:Wed 02 Feb 2022

enaut

Oh wow, I did not think someone would actually read my blog post! Unfortunately, I do not know where to change the font size. I also do not know any PHP, which is why I needed to solve this issue above with "pattern matching". It is probably best to look for someone more knowledgeable than me to solve the problem.

But the solution to your problem is most probably in that file mentioned above.

created:Tue 13 Sep 2022
edited:Tue 13 Sep 2022

Hemanta Kumar Biswal

How to change the font size of Barcode

created:Tue 13 Sep 2022
edited:Tue 13 Sep 2022

enaut

As said, I'm not sure how to do that, this post was more a 'note to future self'. But thank you for reading. You could try asking on the koha mailing list.

Add a new comment

Note that all comments are moderated - so your post will not appear till I find time to accept it.

The comments do use markup syntax.

Name:
Email:
Confirm Email: leave the above line empty!
Comment: