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

question: how can you print a line with this? #16

Open
huydinhle opened this issue Sep 15, 2023 · 3 comments
Open

question: how can you print a line with this? #16

huydinhle opened this issue Sep 15, 2023 · 3 comments

Comments

@huydinhle
Copy link

I would like to print a line to separate out some section but I don't know how or can't find example

@hennedo
Copy link
Owner

hennedo commented Sep 15, 2023

If you just want to print an empty line use the LineFeed() function!
(Example is within the Readme.md)

Edit: I think I missunderstood you, you want a visible line as seperator for some sections?
There is no function for this, but you can do this either by printing
"----------------------------" (depending on your printwidth..)
or by printing an image which contains said line..

@huydinhle
Copy link
Author

Is there a programatic way to find out what is the printwidth of my printer with library?

@justinmichaelvieira
Copy link

justinmichaelvieira commented Nov 29, 2023

Is there a programatic way to find out what is the printwidth of my printer with library?

There isn't a "standard" way to get back the column width in ESC/POS (or this library), because it's only 1-way communication. So, what a lot of softwares will do is ask you to define "columns" somewhere. 44 is usually a good guess initially, because most escpos printers, esp. receipt printers, can handle 44 wide mode... 48+ char width printers will show extra right hand space if max of 44 ascii chars can be sent to the printer.

You can collect a width through ui or just hardcode 44 and potentially be happy with that. Depending on exactly how you want to buffer or tab character spaces into each line.

Edit: Basically, the best advice I can offer is look up your printer by model number and find the manual. Then, configure the column width on the printer, and set the same value in your app (all relevant config file/stored value concerns for this column width value are per your preference).

Edit 2: If you want to use a printer language that is 2-way comm and can let you query printer properties like col width, look up the EPOS standard. Only works with newer Epson printers, however.

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

No branches or pull requests

3 participants