Skip to content

Label - Barcode Size - #1599

Merged
jbtronics merged 3 commits into
Part-DB:masterfrom
calebwest-SS:feat-label-barcode-size
Nov 19, 2026
Merged

jbtronics merged 3 commits into
Part-DB:masterfrom
calebwest-SS:feat-label-barcode-size

Conversation

@calebwest-SS

Copy link
Copy Markdown
Contributor
image

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:
image

calebwest-SS and others added 2 commits October 13, 2026 20:16
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>
@calebwest-SS

calebwest-SS commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

This is the first broken out commit of #1589.

I have tested it independently and am satisfied that it works alone.

@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new issues were found.

Summary

Adds an optional barcode size and updates the label layout.

  • Label makers can set a barcode size for generated labels.
  • Long 1D label text pushes the barcode down instead of running behind it.

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>
@jbtronics

Copy link
Copy Markdown
Member

Looks good. Thank you.

@jbtronics
jbtronics merged commit 0810bd2 into Part-DB:master Nov 19, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants