Esempio n. 1
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
	}
}
Esempio n. 2
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
}
Esempio n. 3
0
//单位:毫米.
//注:由于OKI并没有设置头部的指令。(仅有的一个也只能设置在6.35毫米处).因此要在打印一页纸前调用
//此指令用进纸指令代替
func (jst *OkiPrinter) SetTop(pos float32) error {
	utils.Trace("OkiPrinter received SetTop request")
	if pos < 6.35 {
		return PR2TOPTOOSMALL
	}
	var reallen = pos - 6.35
	utils.Trace("OkiPrinter not have settop instructon,advance line %f ", reallen)
	return jst.SeekColPos(reallen, 6.35)
}
Esempio n. 4
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
	}
}
Esempio n. 5
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
	}
}
Esempio 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
	}
}
Esempio n. 7
0
//回车
func (jst *OlevittePrinter) Carriage() error {
	utils.Trace("OlevittePrinter received Carriage request")
	s, _ := hex.DecodeString("0d20")
	utils.Trace("OlevittePrinter send Carriage pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Esempio n. 8
0
//水平制表
func (js *OkiPrinter) HorizontalTab() error {
	utils.Trace("OlevittePrinter received HorizontalTab request")
	s, _ := hex.DecodeString("09")
	utils.Trace("OlevittePrinter send HorizontalTab pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Esempio n. 9
0
//改变仿真方式到oki
func (jst *OkiPrinter) ChangeToOKI() error {
	utils.Trace("OlevittePrinter received ChangeToOKI request")
	s, _ := hex.DecodeString("1B5E31")
	utils.Trace("OlevittePrinter send ChangeToOKI pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}
Esempio 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
	}
}
Esempio n. 11
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
	}
}
Esempio n. 12
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
	}
}
Esempio n. 13
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
	}
}
Esempio 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
	}
}
Esempio 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
	}
}
Esempio n. 16
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
	}
}
Esempio n. 17
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
	}
}
Esempio n. 18
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
	}
}
Esempio n. 19
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
	}
}
Esempio n. 20
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
	}
}
Esempio n. 21
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
	}
}
Esempio n. 22
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
	}
}
Esempio n. 23
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
	}
}
Esempio n. 24
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
	}
}
Esempio n. 25
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
	}
}
Esempio n. 26
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
	}
}
Esempio n. 27
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
	}
}
Esempio n. 28
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
	}
}
Esempio 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
	}
}
Esempio n. 30
0
//退纸
func (jst *OlevittePrinter) EjectPaper() error {
	utils.Trace("OlevittePrinter received EjectPaper request")
	s, _ := hex.DecodeString("1b4f")
	utils.Trace("OlevittePrinter send EjectPaper pi %x", s)
	if jst.checkJobInPrint() {
		return driverlayer.WriteData(jst.w, s)
	} else {
		return PR2NOTINJOB
	}
}