Repository navigation
Label - Barcode Size - #1599
Merged
Merged
Label - Barcode Size#1599
Conversation
New optional label option "Barcode size" (mm): The edge length of 2D barcodes or the width of 1D barcodes. It is available in the label dialog and the label profile editor, and is included in the profile import/export. If it is empty (the default, and the value of all existing profiles), the existing QR/1D layouts are used unchanged. If it is set, a table based layout is used (label_page_barcode.html.twig): 2D codes left of the text with a 4mm gap, 1D codes at the bottom of the label with their caption. This also fixes 1D barcodes overlapping the text on small labels. The migration Version20260929120000 adds the nullable column options_barcode_size (MySQL, SQLite, PostgreSQL). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without a barcode size, 1D barcodes are placed at a fixed position 32px above the bottom of the label. If the text needs more space than there is above that position, the barcode was drawn over it: On the default 50x30mm label only a single line of text fits above the barcode, while the 8.5mm below it stay empty. Now the barcode follows the text, and the text gets the space above the previous position as minimum height. So the barcode is exactly where it was before if the text fits above it, and is pushed down (into the unused space below it) otherwise. Labels with custom CSS for the barcode (.C39, .C39-container, .C39-text) keep the fixed position, as they may have placed the barcode somewhere else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
This is the first broken out commit of #1589. I have tested it independently and am satisfied that it works alone. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable new issues were found. SummaryAdds an optional barcode size and updates the label layout.
Tests were not run because PHP and installed dependencies are unavailable. Reviews (2) · Last reviewed commit: "Test the 1D barcode layout with the rend..." · Reviewed by Greptile |
The previous test only checked the generated HTML with a single line of text, which fitted above the barcode before the fix as well. The test now lays out the label with dompdf (like LabelGenerator) and checks the positions: - With three lines on a 50x30mm label (which were covered by the barcode before), the barcode starts below the text and stays on the label with its caption - With one line, the barcode keeps its previous position - With custom CSS for the barcode, the fixed position from the CSS is kept Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Looks good. Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a Barcode Size field to the label generator. It defaults to auto (initial behavior), but allows users to scale up barcodes to fit nicely on the label, or scale down if their printer allows.
It also fixes an issue where only one line of text shows above a 1D barcode, and bumps the layout down accordingly.

Example of issue: