Bug 40478

Summary: Add option to justify barcode on labels
Product: Koha Reporter: David Cook <dcook>
Component: Label/patron card printingAssignee: Lucas Gass (lukeg) <lucas>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: andrew, lucas
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40473
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:
This patchset adds a "Barcode justification" option to label layouts. This allows the user to justify CODE39, COOP2of5, Industrial2of5 and EAN13 barcodes independently of any other content in the label layout.
Version(s) released in:
Circulation function:
Attachments: Bug 40478: Database update to add barcode_justify column to creator_layouts
Bug 40478: Add ability to justify CODE39 barcodes
Bug 40478: Add support for COOP2of5, Industrial2of5 and EAN13
Bug 40478: Database update to add barcode_justify column to creator_layouts
Bug 40478: Add ability to justify CODE39 barcodes
Bug 40478: Add support for COOP2of5, Industrial2of5 and EAN13

Description David Cook 2025-07-23 07:06:42 UTC
Bug 40473 fixes barcode length calculator of Code39 barcodes in the label creator. When using barcode width of 1 or 100%, the barcode will be centred on the label.

But if you use a smaller barcode width, your barcode will be left aligned.

Surely it would be good to have the ability to have centred barcodes even when using narrower barcodes?
Comment 1 Lucas Gass (lukeg) 2026-01-21 18:33:11 UTC
Created attachment 191811 [details] [review]
Bug 40478: Database update to add barcode_justify column to creator_layouts
Comment 2 Lucas Gass (lukeg) 2026-01-21 18:33:14 UTC
Created attachment 191812 [details] [review]
Bug 40478: Add ability to justify CODE39 barcodes
Comment 3 Lucas Gass (lukeg) 2026-01-21 18:34:59 UTC
WIP. So far only handling CODE39 and I have not tested with the different barcode widths that David mentions.
Comment 4 Lucas Gass (lukeg) 2026-01-27 22:32:01 UTC
Created attachment 192111 [details] [review]
Bug 40478: Add support for COOP2of5, Industrial2of5 and EAN13
Comment 5 Lucas Gass (lukeg) 2026-01-27 22:38:53 UTC
Created attachment 192112 [details] [review]
Bug 40478: Database update to add barcode_justify column to creator_layouts
Comment 6 Lucas Gass (lukeg) 2026-01-27 22:38:56 UTC
Created attachment 192113 [details] [review]
Bug 40478: Add ability to justify CODE39 barcodes

To test:
1. Apply patch, updatedatabase, restart_all
2. Create at least 1 label batch
3. Create or edit an existing layout.
4. You should now see a dropdown labeled "Barcode justification:" with options to align left, right, and center.
5. At this point I like to check "Draw guide boxes" as it makes testing alignment much easier.
6. Now test generating label sets to "Download as PDF".
7. You will want to make sure the barcode properly aligns left, right, and center.
8. Test with all the  different "Choose barcode type (encoding):" options. Ensuring the barcodes align correectly left, right, and center.
9. Also test with all the different "Choose layout type:" that will display a barcode.
Comment 7 Lucas Gass (lukeg) 2026-01-27 22:38:58 UTC
Created attachment 192114 [details] [review]
Bug 40478: Add support for COOP2of5, Industrial2of5 and EAN13