Skip to content

Commit

Permalink
Fix code128 barcode string length calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy5312 authored and lsongdev committed Oct 24, 2022
1 parent 8d9951b commit 86fb777
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/printer/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export function getParityBit(str: string) {
}

export function codeLength(str: string) {
let buff = Buffer.from((str.length).toString(16), 'hex');
const hex = Number(str.length).toString(16).padStart(2, '0')
let buff = Buffer.from(hex, 'hex');
return buff.toString();
}

Expand Down

0 comments on commit 86fb777

Please sign in to comment.