Skip to content
This repository has been archived by the owner on Dec 18, 2022. It is now read-only.

Line wrapping bug #52

Open
verdant-spark opened this issue Oct 27, 2021 · 1 comment
Open

Line wrapping bug #52

verdant-spark opened this issue Oct 27, 2021 · 1 comment

Comments

@verdant-spark
Copy link

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.

@hand-dot
Copy link
Owner

hand-dot commented Feb 10, 2022

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?
#40

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants