Bug 41718

Summary: draw_guide_grid() passes incorrect arguments to PDF methods, causing warnings.
Product: Koha Reporter: Chris Nighswonger <chris.nighswonger>
Component: Label/patron card printingAssignee: Chris Nighswonger <chris.nighswonger>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: dcook
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Chris Nighswonger 2026-01-27 02:55:34 UTC
Patroncard.pm:219-221:
  $pdf->Font('Courier');
  $pdf->FontSize($font_size);
  my $strtop_len = $pdf->StrWidth($strtop) * 1.5;

There are actually two underlying bugs here:

Bug 1 (line 219): Uses hardcoded 'Courier' font name. This may not match a TTF config entry, and the fallback to prFont('Courier') may not work as expected.

Bug 2 (line 221): Calls $pdf->StrWidth($strtop) with only one argument, but StrWidth() in PDF.pm expects ($string, $font, $fontSize):

 # PDF.pm:411
  my ( $string, $font, $fontSize ) = @_;
  $font = C4::Creators::PDF->Font($font);  # $font is undef → warnings

 The correct call should be:
  my $strtop_len = $pdf->StrWidth($strtop, 'Courier', $font_size) * 1.5;