width => $params{'width'},
layout => $params{'layout'},
text_wrap_cols => $params{'text_wrap_cols'},
+ barcode_height_scale => $params{'layout'}->{'barcode'}[0]->{'height_scale'} || 0.01,
+ barcode_width_scale => $params{'layout'}->{'barcode'}[0]->{'width_scale'} || 0.8,
};
bless ($self, $type);
return $self;
sub draw_barcode {
my ($self, $pdf) = @_;
-#FIXME: We do some scaling foo on the barcode here which probably should be done by the one invoking draw_barcode
- my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width
- my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 1% of the label height
+ # Default values for barcode scaling are set in constructor to work with pre-existing installations
+ my $barcode_height_scale = $self->{'barcode_height_scale'};
+ my $barcode_width_scale = $self->{'barcode_width_scale'};
+
_draw_barcode( $self,
llx => $self->{'llx'} + $self->{'layout'}->{'barcode'}->[0]->{'llx'},
lly => $self->{'lly'} + $self->{'layout'}->{'barcode'}->[0]->{'lly'},
- width => $barcode_width,
- y_scale_factor => $barcode_y_scale_factor,
+ width => $self->{'width'} * $barcode_width_scale,
+ y_scale_factor => $self->{'height'} * $barcode_height_scale,
barcode_type => $self->{'layout'}->{'barcode'}->[0]->{'type'},
barcode_data => $self->{'layout'}->{'barcode'}->[0]->{'data'},
text => $self->{'layout'}->{'barcode'}->[0]->{'text_print'},
<input type="text" name="barcode_lly" id="barcode_lly" size="2" value="[% barcode_lly |html %]" />
</li>
<li>
+ <label for="barcode_height_scale">Scale height (relative to card): </label>
+ <input type="text" name="barcode_height_scale" id="barcode_height_scale" size="2" value="[% barcode_height_scale |html %]" />
+ </li>
+ <li>
+ <label for="barcode_width_scale">Scale width (relative to card): </label>
+ <input type="text" name="barcode_width_scale" id="barcode_width_scale" size="2" value="[% barcode_width_scale |html %]" />
+ </li>
+ <li>
<label for="barcode_type">Barcode type: </label>
<select name="barcode_type" id="barcode_type">
[% FOREACH barcode_typ IN barcode_type %]
height => $pc_template->get_attr('label_height'), # of the card
width => $pc_template->get_attr('label_width'),
layout => $layout_xml,
- text_wrap_cols => 30, #FIXME: hardcoded
+ text_wrap_cols => 30, #FIXME: hardcoded,
);
+
$patron_card->draw_guide_box($pdf) if $layout_xml->{'guide_box'};
$patron_card->draw_barcode($pdf) if $layout_xml->{'barcode'};
push @text_fields, (
"field_" . $field_number . "_llx" => $field_params->{'llx'},
"field_" . $field_number . "_lly" => $field_params->{'lly'},
+ "field_" . $field_number . "_height_scale" => $field_params->{'height_scale'},
+ "field_" . $field_number . "_width_scale" => $field_params->{'width_scale'},
"field_" . $field_number . "_font" => _set_selected($field_params->{'font'}, $font_types),
"field_" . $field_number . "_font_size" => $field_params->{'font_size'},
"field_" . $field_number . "_text_alignment" => _set_selected($field_params->{'text_alignment'}, $alignment_types),