Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text wrap #13

Closed
mic7010 opened this issue May 20, 2021 · 6 comments
Closed

Text wrap #13

mic7010 opened this issue May 20, 2021 · 6 comments
Assignees

Comments

@mic7010
Copy link

mic7010 commented May 20, 2021

How do I control printing descriptions that exceed the label width? Do you support wrapping or other methods?

@bandit-ibayashi
Copy link
Member

@mic7010 If the text data is more than the label width, it will automatically be printed on the next line.
Each printer has a specific number of characters that can be printed, so please let us know the model name of the printer you want to print.

@mic7010
Copy link
Author

mic7010 commented May 31, 2021

The model is the sm-l300. I did a test with a long description which was not wrapped. Can you provide a code snippet? Also, can I set a max lines to print?

@bandit-ibayashi
Copy link
Member

I have printed a 50 character text as shown below and confirmed that it wraps at the 49th character as shown in the picture.

var builder = new StarXpandCommand.StarXpandCommandBuilder();
builder.addDocument(new StarXpandCommand.DocumentBuilder()
    .addPrinter(new StarXpandCommand.PrinterBuilder()
        .actionPrintText("12345678901234567890123456789012345678901234567890\n")
        .actionCut(StarXpandCommand.Printer.CutType.Partial)
    )
);
var commands = await builder.getCommands();

await printer.open();
await printer.print(commands);

@bandit-ibayashi bandit-ibayashi self-assigned this Jun 4, 2021
@bandit-ibayashi
Copy link
Member

Although not in terms of the number of characters, you can also specify the print area in millimeters by settingPrintableArea method.

The following is an example of setting the width to 48mm.

var builder = new StarXpandCommand.StarXpandCommandBuilder();
builder.addDocument(new StarXpandCommand.DocumentBuilder()
    .settingPrintableArea(48)
    .addPrinter(new StarXpandCommand.PrinterBuilder()
        .actionPrintText("12345678901234567890123456789012345678901234567890\n")
        .actionCut(StarXpandCommand.Printer.CutType.Partial)
    )
);

@kickbk
Copy link

kickbk commented Feb 23, 2022

Setting the width is not at all an answer to this question. It does not help in any way to avoid breaking words. If there is no way to avoid word breaking, please confirm by letting us know there is no way to avoid it. If there's a way, please advise.

@gare-bear
Copy link
Contributor

gare-bear commented Feb 23, 2022

@kickbk Star printers always break mid character if you exceed the maximum characters per line; they do not word wrap.

All of our printers have two fonts, Font A and Font B.
Using Font A, our 3" printers allow for 48 characters per line.
Using Font B which is the smaller width font, you can get up to 64 characters per line.

Knowing how many characters per line your printer supports will help you avoid word breaks and any unintentional wrapping.

I'm going to lock this conversation since this issue has been closed for some time.
Please open a new issue for your specific use case if you need more help on this topic.

@star-micronics star-micronics locked as resolved and limited conversation to collaborators Feb 23, 2022
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

4 participants