Ejemplo n.º 1
0
//直接进纸n/120英寸。1B-25-35-n(01 =< n <= FF)
func (jst *OkiPrinter) SeekColPos(pos float32, currpos float32) error {
	if pos == 0 {
		utils.Trace("pos is zero ,skip")
		return nil
	}

	inch := int(utils.ConvertFrommmToInch(pos) * float32(120))
	remain := inch
	for {
		//oki的最大位移为255/120 inch
		if remain > 255 {
			s, _ := hex.DecodeString("1b2535ff")
			utils.Trace("OkiPrinter send AdvanceLine pi %x", s)
			if jst.checkJobInPrint() {
				driverlayer.WriteData(jst.w, s)
			} else {
				return PR2NOTINJOB
			}
			remain -= 255
		} else {
			var d uint8 = uint8(remain) & 0xff
			s, _ := hex.DecodeString("1b2535" + utils.FormatInt(int(d), 2, "0", 16) + "20")
			utils.Trace("OkiPrinter send AdvanceLine pi %x", s)
			if jst.checkJobInPrint() {
				return driverlayer.WriteData(jst.w, s)
			} else {
				return PR2NOTINJOB
			}
			break
		}
	}
	return nil
}
Ejemplo n.º 2
0
//设置汉字字体。0、1、2、3分别是:宋、仿、楷、繁。
func (jst *OkiPrinter) SetChineseTypeface(font int) error {
	utils.Trace("OkiPrinter received SetChineseTypeface request")
	switch font {
	case 0:
		s, _ := hex.DecodeString("1C7630")
		break
	case 1:
		s, _ := hex.DecodeString("1C7631")
		break
	case 2:
		s, _ := hex.DecodeString("1C7632")
		break
	case 3:
		s, _ := hex.DecodeString("1C7633")
		break
	default:
		s, _ := hex.DecodeString("1C7630")
		break
	}
	utils.Trace("OkiPrinter send SetChineseTypeface pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 3
0
func (jst *OkiPrinter) OutputByte(s []byte) error {
	utils.Trace("OkiPrinter received OutputByte request")
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 4
0
//响铃
func (jst *OkiPrinter) Diabolo() error {
	utils.Trace("OlevittePrinter received Diabolo request")
	s, _ := hex.DecodeString("07")
	utils.Trace("OlevittePrinter send Diabolo pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 5
0
func (jst *OkiPrinter) ChanageToIBM() error {
	utils.Debug("OlevittePrinter received ChanageToIBM request")
	s, _ := hex.DecodeString("1B5E30")
	utils.Debug("OlevittePrinter send ChanageToIBM pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 6
0
//设置单页纸出纸方向(30:向前出纸;31:向后出纸)
func (jst *OkiPrinter) OutPaperBackward() error {
	utils.Trace("OkiPrinter received OutPaperDirection request")
	s, _ := hex.DecodeString("1B5431")
	utils.Trace("OkiPrinter send OutPaperDirection pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 7
0
//设置半角字合成方式。当在汉字竖向书写方式下接收到此码后,打印机将在此码后的两半角字字符合成起来作为合成字符。不持续有效
func (jst *OkiPrinter) SetDBC_caseCompose() error {
	utils.Trace("OkiPrinter received SetDBC_caseCompose request")
	s, _ := hex.DecodeString("1C5F")
	utils.Trace("OkiPrinter send SetDBC_caseCompose pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 8
0
//取消上下标打印
func (jst *OkiPrinter) CancelSuper_Sub_Script() error {
	utils.Trace("OkiPrinter received CancelSuper_Sub_Script request")
	s, _ := hex.DecodeString("1C53")
	utils.Trace("OkiPrinter send CancelSuper_Sub_Script pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 9
0
//设置双向打印方式
func (jst *OkiPrinter) SetDiprosopyOrientation() error {
	utils.Trace("OkiPrinter received SetDiprosopyOrientation request")
	s, _ := hex.DecodeString("1b2542")
	utils.Trace("OkiPrinter send SetDiprosopyOrientation pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 10
0
func (jst *OkiPrinter) OutputString(s string) error {
	utils.Trace("OkiPrinter received OutputString request")
	ds, _ := utils.TransGBKFromUTF8(s)
	utils.Trace("OkiPrinter send OutputString pi %x", ds)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, ds)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 11
0
func (jst *OlevittePrinter) CancelBold() error {
	utils.Debug("OlevittePrinter received CancelBold request")
	s, _ := hex.DecodeString("1b29")
	utils.Debug("OlevittePrinter send CancelBold pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 12
0
//赋予手动操作
func (jst *OkiPrinter) PrinterManualControl() error {
	utils.Trace("OlevittePrinter received PrinterManualControl request")
	s, _ := hex.DecodeString("1B5F")
	utils.Trace("OlevittePrinter send PrinterManualControl pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 13
0
//选择Olivetti对话进程  控制的数据交换进程(仅在 OLIVETTI 仿真方式时才接受)
func (jst *OkiPrinter) ChooseOlivettiProcess() error {
	utils.Trace("OlevittePrinter received ChooseOlivettiProcess request")
	s, _ := hex.DecodeString("1B6E")
	utils.Trace("OlevittePrinter send ChooseOlivettiProcess pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 14
0
//SET-UP 配置请求。 由主机发出,要求打印机回答它自身的 SET-UP 配置
func (jst *OkiPrinter) SER_UP_ConfiguerRequest() error {
	utils.Trace("OlevittePrinter received SER_UP_ConfiguerRequest request")
	s, _ := hex.DecodeString("1B2061")
	utils.Trace("OlevittePrinter send SER_UP_ConfiguerRequest pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 15
0
//打印介质请求状态。 由主机发出,要求打印机回答关于打印介质当前所处位置的状态。
func (jst *OkiPrinter) PrinterPaperStateRequest() error {
	utils.Trace("OlevittePrinter received PrinterPaperStateRequest request")
	s, _ := hex.DecodeString("1B2042")
	utils.Trace("OlevittePrinter send PrinterPaperStateRequest pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 16
0
func (jst *OkiPrinter) CancelHorizontalCompress() error {
	utils.Trace("OkiPrinter received CancelHorizontalCompress request")
	s, _ := hex.DecodeString("1B3E")
	utils.Trace("OkiPrinter send CancelHorizontalCompress pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 17
0
//取消倍高
func (jst *OkiPrinter) CancelDoublePrintHeight() error {
	utils.Trace("OkiPrinter received CancelDoublePrintHeight request")
	s, _ := hex.DecodeString("1b5d")
	utils.Trace("OkiPrinter send CancelDoublePrintHeight pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 18
0
//进纸一行
func (jst *OkiPrinter) AdvanceOneLine() error {
	utils.Debug("OkiPrinter received Initfirstline request")
	s, _ := hex.DecodeString("0d0a20")
	utils.Debug("OkiPrinter send Initfirstline pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 19
0
//取消汉字方式。不取消半角方式
func (jst *OkiPrinter) CancelChinese() error {
	utils.Trace("OkiPrinter received CancelChinese request")
	s, _ := hex.DecodeString("1B2848")
	utils.Trace("OkiPrinter send CancelChinese pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 20
0
//设置1/8英寸行据
func (jst *OkiPrinter) Rowledge_8LPI() error {
	utils.Trace("OkiPrinter received Rowledge_8LPI request")
	s, _ := hex.DecodeString("1B38")
	utils.Trace("OkiPrinter send Rowledge_8LPI pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 21
0
//设备控制3
func (jst *OkiPrinter) DeviceControl3() error {
	utils.Trace("OkiPrinter received DeviceControl3 request")
	s, _ := hex.DecodeString("13")
	utils.Trace("OkiPrinter send DeviceControl3 pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 22
0
//退格
func (jst *OkiPrinter) Backspace() error {
	utils.Trace("OkiPrinter received Backspace request")
	s, _ := hex.DecodeString("08")
	utils.Trace("OkiPrinter send Backspace pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 23
0
//清除打印机缓冲
func (jst *OkiPrinter) CleanPrinterRom() error {
	utils.Trace("OkiPrinter received CleanPrinterRom request")
	s, _ := hex.DecodeString("18")
	utils.Trace("OkiPrinter send CleanPrinterRom pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 24
0
//设置低噪音打印方式
func (jst *OkiPrinter) Low_noisePrint() error {
	utils.Trace("OkiPrinter received Low_noisePrint request")
	s, _ := hex.DecodeString("1B4F")
	utils.Trace("OkiPrinter send Low_noisePrint pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 25
0
//取消禁止半角字字符竖写方式
func (jst *OkiPrinter) CancelForbidDBC_caseErect() error {
	utils.Trace("OkiPrinter received CancelForbidDBC_caseErect request")
	s, _ := hex.DecodeString("1C75")
	utils.Trace("OkiPrinter send CancelForbidDBC_caseErect pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 26
0
//设置倍宽打印
func (jst *OkiPrinter) DoublePrintWidth() error {
	utils.Trace("OkiPrinter received DoublePrintWidth request")
	s, _ := hex.DecodeString("1b55")
	utils.Trace("OkiPrinter send DoublePrintWidth pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 27
0
//打印机初始化
func (jst *OkiPrinter) Init() error {
	utils.Debug("OlevittePrinter received initPrinter request")
	s, _ := hex.DecodeString("1042")
	utils.Debug("OlevittePrinter send initPrinter pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 28
0
//取消全角汉字的双倍水平扩展打印方式
func (jst *OkiPrinter) CancelSBC_caseDouble_width() error {
	utils.Trace("OkiPrinter received CancelSBC_caseDouble_width request")
	s, _ := hex.DecodeString("1C71")
	utils.Trace("OkiPrinter send CancelSBC_caseDouble_width pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 29
0
//设置SetShift_jis 方式
func (jst *OkiPrinter) SetShift_jis() error {
	utils.Trace("OkiPrinter received SetShift_jis request")
	s, _ := hex.DecodeString("1B6B")
	utils.Trace("OkiPrinter send SetShift_jis pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Ejemplo n.º 30
0
//反向换行
func (jst *OkiPrinter) ReverseChangeLine() error {
	utils.Trace("OlevittePrinter received ReverseChangeLine request")
	s, _ := hex.DecodeString("1b37")
	utils.Trace("OlevittePrinter send ReverseChangeLine pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}