Comments (15)
Mhh. What kind of printer are you using? Could you provide me with a minimal (but complete) code snippet that causes this bug to appear?
from escpos.
I was also thinking that it could be the printer, is a "sol802" thermal printer
http://postektronics.com/productdetails/SOL802
The code:
package main
import (
"net"
"github.com/hennedo/escpos"
)
func main() {
socket, err := net.Dial("tcp", "192.168.7.90:9100")
if err != nil {
println(err.Error())
}
defer socket.Close()
p := escpos.New(socket)
p.Bold(true).Size(2, 2).Write("Hello World")
p.LineFeed()
p.PrintAndCut()
}
And the result:
Hello World0
from escpos.
Printer config
`Print Speed 250mm/s
Print Density Medium
Print Width 72mm
Print Direction Normal
Print Font 12*24
Auto Cut on
ChangePaperRePrint off
Buzzer Enable Error On
Command Set ESC/POS
Code Page ISO-8859-15`
from escpos.
Sadly there is not that much information available about the printe. Currently my best guess is that it has to do something with the cut command. In the ESC/POS manual there are 3 ways to perform a cut. Could you clone the library locally and replace it in your project with the local version?
Within your go mod, just before the require part
replace github.com/hennedo/escpos => /home/.../escpos
Then replace
func (e *Escpos) Cut() (int, error) {
return e.WriteRaw([]byte{gs, 'V', 'A', '0'})
}
with
func (e *Escpos) Cut() (int, error) {
return e.WriteRaw([]byte{esc, 'i'})
}
// or if that does not work
func (e *Escpos) Cut() (int, error) {
return e.WriteRaw([]byte{esc, 'm'})
}
One of those could possibly work..
from escpos.
I'm going to test with that code.
Thank you very much for the reply and speed!
from escpos.
It did not work
I'm going to keep trying and I'll put any solution here .
Thanks again.
from escpos.
Sorry that I could not be of more help. If you do find any solution, even if it's another open source library that I can have a look at that works, I'm interested!
from escpos.
I am adapting the augustopimenta library with yours and so far it works: charset, image, barcode (qr, upca, ean8 and ean13) and I added tables with tablewriter
Links to libraries
"github.com/augustopimenta/escpos"
"github.com/olekukonko/tablewriter"
I am working with Code128 and a problem with the images
When I finish I upload it to github
Thanks again Hendrik!
from escpos.
I'm running into this issue aswell, with an EPSON TM-T88II printer. Did you ever find a solution to this?
Printing images works fine, but any text has a "0" appended
from escpos.
Dang. I if @AurumAustralis did not find a solution for this I might need to buy an EPSON TM-T88II off of ebay-kleinanzeigen to work on a solution :D
from escpos.
After some debugging on my "new" printer, it seems it does not support the upside down printing, so as the library always pushes the current state when you call write, it sends the codes for upside down printing. the printer then ignores the ESC+{ and prints the 0 which is intended to tell the printer "no upsidedown printing please".
I refresh every setting set in the library with each write because when using a networked printer it's quite possible that another user sets different settings. I need find a solution for this. Maybe some sort of feature enable / disable depending on the model.
from escpos.
Thanks for investigating! Let me know if you need help testing, I've got a printer sitting on my desk.
from escpos.
So I added a config struct to disable certain features that are called during the write process and added some Device configs. Could you replace your dependency with a local copy of the compatibility_fix branch and confirm that everything works fine when you are adding the SetConfig line right after the escpos.New call?
p := escpos.New(socket)
// add here:
p.SetConfig(escpos.ConfigEpsonTMT88II)
Also if @AurumAustralis is still interested, would be good to know if this works for you also...
from escpos.
@hennedo I can confirm this fixes the issue with the Epson TM T88II, no more zeros. I noticed though, the QRcodes are not printed, not sure if this is related to the fix or a different issue, the code I'm using is this:
https://gist.github.com/pinpox/c360111ede61f8f62aa0c6cd2a3fb284
from escpos.
As QR code printing is a printerfeature the qr code is not generated by the library. Therefore the printer needs to support qr code printing. I do not think the TM-T88II supports QR code printing.
I'll merge the fix in master then!
from escpos.
Related Issues (15)
- Not cutting according to the printer model HOT 7
- Libiconv dependency handling HOT 4
- Epson TMU220
- centering the QR code
- question: how can you print a line with this? HOT 3
- BrokenImport HOT 1
- p.SetConfig unavailable
- WASM build failing HOT 3
- Cyrillic HOT 10
- Doesn't work on WASM HOT 4
- Printing images is extremely slow HOT 1
- can't read errors from the printer
- p.SetConfig undefined (type *escpos.Escpos has no field or method SetConfig) HOT 1
- Printing from a printer with an internal IP HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from escpos.