fix: restore barcode text population for QR code objects#41
Open
ji-kwon-sherpas wants to merge 1 commit into
Open
fix: restore barcode text population for QR code objects#41ji-kwon-sherpas wants to merge 1 commit into
ji-kwon-sherpas wants to merge 1 commit into
Conversation
In v2.2.0, barcode objects were populated using `obj.Text = value` in addition to `Doc.SetBarcodeData()`. The `obj.Text` assignment was removed during the v3.0.0 refactor, causing QR code objects to retain their default template values instead of being updated with the provided data. `Doc.GetBarcodeIndex(key)` returns `undefined` for QR code objects, which causes `Doc.SetBarcodeData(undefined, value)` to silently fail. Since `IObject::SetText` correctly sets barcode data (including QR codes), this commit replaces the broken `GetBarcodeIndex` + `SetBarcodeData` approach with the simpler and working `obj.Text` assignment, matching the behavior from v2.2.0.
Owner
|
Thanks for that. Could you provide a bit more detail? Specifically, what type of barcode was used, and a sample of the data for reference? |
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.
Problem
In v3.0.0, QR code (barcode) objects in templates are not being populated with the provided data. Instead, the default value hardcoded in the
.lbxtemplate file is printed/previewed.This is a regression from v2.2.0, which had the changelog entry: "Patched a bug where QR codes were not being populated".
Root Cause
In v2.2.0,
populateObjectsInTemplatehandled barcode objects with bothobj.Text = valueandDoc.SetBarcodeData():During the v3.0.0 refactor,
obj.Text = valuewas removed:The problem is that
Doc.GetBarcodeIndex(key)returnsundefinedfor QR code objects. This causesDoc.SetBarcodeData(undefined, value)to silently do nothing — no error is thrown, but the barcode data is never updated.Fix
Replace the broken
GetBarcodeIndex+SetBarcodeDataapproach withobj.Text = value, which correctly sets data for all barcode types including QR codes viaIObject::SetText. This matches the working behavior from v2.2.0.Testing
Verified with Brother PT-P900W using
.lbxtemplates containing QR code objects:getImageData) and print (print)