labelmake
labelmake copied to clipboard
Line wrapping bug
When creating a label with the below definition, the last char of a couple of lines wraps to the next line, with the next line overlapping that last/first char.
basePdf: {width: 50, height: 25},
schemas: [
{
'order_name': {
'type': 'text',
'position': {'x': 0, 'y': 1},
'width': 49,
'height': 2,
'alignment': 'right',
'fontSize': 5,
'characterSpacing': 0,
'lineHeight': 1,
},
'message': {
'type': 'text',
'position': {'x': 2, 'y': 3},
'width': 46,
'height': 17,
'alignment': 'left',
'fontSize': 10,
'characterSpacing': 0,
'lineHeight': 1,
}
}],
};
inputs = rows.map(row => ({
order_name: row.order_name,
message: row.message,
}));
For testing:
row.order_name = ABC-1234
row.message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec posuere nulla risus, eu suscipit ex imperdiet sed. Nam consectetur ullamcorper nibh, non.'
Resultant pdf: messages (7).pdf
Note that if font size is dropped to 9 then the issue doesn't appear, so I'm guessing it's just a magical combination of character line length and font size vs box width.
Thank's report.
Note that if font size is dropped to 9 then the issue doesn't appear, so I'm guessing it's just a magical combination of character line length and font size vs box width.
I see. Could you use 'splitThreshold' option to avoid this problem? https://github.com/hand-dot/labelmake/pull/40