Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Created April 9, 2017 13:04
Show Gist options
  • Save Akkiesoft/0e57b7c6ade921ff4bcb506f92584bb1 to your computer and use it in GitHub Desktop.
Save Akkiesoft/0e57b7c6ade921ff4bcb506f92584bb1 to your computer and use it in GitHub Desktop.
ESCPOSで日本語を試そうとしているスクリプト(うごかない)
# -*- coding: utf-8 -*-
# python_escpos-3.0a1.dev1+ng5078c49-py3.4.egg
from escpos import *
class CustomUsb(printer.Usb):
def raw(self, code):
self._raw(code)
def text_jis(self, str):
self._raw(str.encode("shift-jis"))
Epson = CustomUsb(0x08a6,0x0041)
# enable japanese
Epson.raw(b'\x1b' + b'\x52' + b'\x08')
Epson.raw(b'\x1b' + b'\x74' + b'\x01')
Epson.raw(b'\x1c' + b'\x43' + b'\x01')
Epson.text("パン人間\n")
Epson.text_jis("パン大臣\n\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment