跳转到内容

ESC/POS SDK 完整索引

本索引按语言收录固定版本中该模块的全部命令参数源文件和枚举。EMAPI 收录命令工厂、载荷、会话和编解码入口;C 收录兼容接口。展开查看参数声明摘录,通过固定版本源码链接核对完整默认值、条件分支和序列化。标题中的命令头预览来自源码字面量,不是完整的指令格式。

声明保留实现中已有的差异。收录表示存在对应实现,不表示所有打印机都支持。发送前请查阅兼容性与验证。

查看协议说明 →

源文件数: 51.

advanced.go — 1B 2D

完整参数、默认值与命令编码

type PLineChar struct {
BasePOSArg
Char byte // 行字符
}
func NewPLineChar() *PLineChar {
func (p *PLineChar) SetChar(char byte) *PLineChar {
func (p *PLineChar) Header() []byte {
func (p *PLineChar) Clause() *command.Clause {
type PLine struct {
BasePOSArg
Length int // 线条长度
}
func NewPLine() *PLine {
func (p *PLine) SetLength(length int) *PLine {
func (p *PLine) Header() []byte {
func (p *PLine) Clause() *command.Clause {
type PPicFlash struct {
BasePOSArg
PicName string // 图片名称
X int // X坐标
Y int // Y坐标
}
func NewPPicFlash() *PPicFlash {
func (p *PPicFlash) SetPicName(name string) *PPicFlash {
func (p *PPicFlash) SetPosition(x, y int) *PPicFlash {
func (p *PPicFlash) Header() []byte {
func (p *PPicFlash) Clause() *command.Clause {
type PBatteryVolume struct {
BasePOSArg
}
func NewPBatteryVolume() *PBatteryVolume {
func (p *PBatteryVolume) Header() []byte {
func (p *PBatteryVolume) Clause() *command.Clause {
func (p *PBatteryVolume) Newline() bool {
type PPageAdvanced struct {
BasePOSArg
Width int // 页面宽度
Height int // 页面高度
}
func NewPPageAdvanced() *PPageAdvanced {
func (p *PPageAdvanced) SetSize(width, height int) *PPageAdvanced {
func (p *PPageAdvanced) Header() []byte {
func (p *PPageAdvanced) Clause() *command.Clause {
barcode.go — 1B 4D

完整参数、默认值与命令编码

type PBarCode struct {
BasePOSArg
X int // x坐标
Y int // y坐标
CodeType int // 条码类型
Height int // 条码高度
Readable int // 是否显示可读文字
Rotation types.Rotation // 旋转角度
Narrow int // 窄条宽度
Wide int // 宽条宽度
Content string // 条码内容
}
func NewPBarCode() *PBarCode {
func (p *PBarCode) SetPosition(x, y int) *PBarCode {
func (p *PBarCode) SetCodeType(codeType int) *PBarCode {
func (p *PBarCode) SetHeight(height int) *PBarCode {
func (p *PBarCode) SetReadable(readable int) *PBarCode {
func (p *PBarCode) SetRotation(rotation types.Rotation) *PBarCode {
func (p *PBarCode) SetWidth(narrow, wide int) *PBarCode {
func (p *PBarCode) SetContent(content string) *PBarCode {
func (p *PBarCode) Header() []byte {
func (p *PBarCode) Clause() *command.Clause {
func (p *PBarCode) processCode128(content []byte) []byte {
type PQRCode struct {
BasePOSArg
X int // x坐标
Y int // y坐标
Level types.Level // 纠错等级
CellWidth int // 单元格宽度
Rotation types.Rotation // 旋转角度
Content string // 二维码内容
}
func NewPQRCode() *PQRCode {
func (p *PQRCode) SetPosition(x, y int) *PQRCode {
func (p *PQRCode) SetLevel(level types.Level) *PQRCode {
func (p *PQRCode) SetCellWidth(width int) *PQRCode {
func (p *PQRCode) SetRotation(rotation types.Rotation) *PQRCode {
func (p *PQRCode) SetContent(content string) *PQRCode {
func (p *PQRCode) Header() []byte {
func (p *PQRCode) Clause() *command.Clause {
font.go — 1B 4D

完整参数、默认值与命令编码

type FontType int
const (
func (f FontType) GetFont() byte {
type PFont struct {
BasePOSArg
Font FontType // 字体类型
}
func NewPFont() *PFont {
func (p *PFont) SetFont(font FontType) *PFont {
func (p *PFont) Header() []byte {
func (p *PFont) Clause() *command.Clause {
type PFontSize struct {
BasePOSArg
Size int // 字体大小 0-7
}
func NewPFontSize() *PFontSize {
func (p *PFontSize) SetSize(size int) *PFontSize {
func (p *PFontSize) Header() []byte {
func (p *PFontSize) Clause() *command.Clause {
type PCharSpace struct {
BasePOSArg
Space int // 字符间距
}
func NewPCharSpace() *PCharSpace {
func (p *PCharSpace) SetSpace(space int) *PCharSpace {
func (p *PCharSpace) Header() []byte {
func (p *PCharSpace) Clause() *command.Clause {
type PLineSpace struct {
BasePOSArg
Space int // 行间距
}
func NewPLineSpace() *PLineSpace {
func (p *PLineSpace) SetSpace(space int) *PLineSpace {
func (p *PLineSpace) Header() []byte {
func (p *PLineSpace) Clause() *command.Clause {
type PRotation struct {
BasePOSArg
Rotation types.Rotation // 旋转角度
}
func NewPRotation() *PRotation {
func (p *PRotation) SetRotation(rotation types.Rotation) *PRotation {
func (p *PRotation) Header() []byte {
func (p *PRotation) Clause() *command.Clause {
image_advanced.go — 1D 76 30 03 1D 76 30 00

完整参数、默认值与命令编码

type PImageAdvanced struct {
BasePOSArg
X int // 图片起始X坐标
Y int // 图片起始Y坐标
Width int // 图片宽度
Height int // 图片高度
ImageData []byte // 图片数据
Mode int // 图片模式 0:正常 1:倍宽 2:倍高 3:倍宽高
GrayThreshold int // 二值化阈值 0-255
Compress bool // 是否压缩
Reverse bool // 是否反色
}
func NewPImageAdvanced() *PImageAdvanced {
func (p *PImageAdvanced) SetPosition(x, y int) *PImageAdvanced {
func (p *PImageAdvanced) SetSize(width, height int) *PImageAdvanced {
func (p *PImageAdvanced) SetImageData(data []byte) *PImageAdvanced {
func (p *PImageAdvanced) SetMode(mode int) *PImageAdvanced {
func (p *PImageAdvanced) SetGrayThreshold(threshold int) *PImageAdvanced {
func (p *PImageAdvanced) SetCompress(compress bool) *PImageAdvanced {
func (p *PImageAdvanced) SetReverse(reverse bool) *PImageAdvanced {
func (p *PImageAdvanced) Header() []byte {
func (p *PImageAdvanced) Clause() *command.Clause {
type PPageQRCodeAdvanced struct {
BasePOSArg
X int // 二维码起始X坐标
Y int // 二维码起始Y坐标
Level types.Level // 纠错等级
CellWidth int // 单元格宽度
Rotation types.Rotation // 旋转角度
Content string // 二维码内容
Model int // 二维码模型 1或2
Mask int // 掩码模式 0-7
}
func NewPPageQRCodeAdvanced() *PPageQRCodeAdvanced {
func (p *PPageQRCodeAdvanced) SetPosition(x, y int) *PPageQRCodeAdvanced {
func (p *PPageQRCodeAdvanced) SetLevel(level types.Level) *PPageQRCodeAdvanced {
func (p *PPageQRCodeAdvanced) SetCellWidth(width int) *PPageQRCodeAdvanced {
func (p *PPageQRCodeAdvanced) SetRotation(rotation types.Rotation) *PPageQRCodeAdvanced {
func (p *PPageQRCodeAdvanced) SetContent(content string) *PPageQRCodeAdvanced {
func (p *PPageQRCodeAdvanced) SetModel(model int) *PPageQRCodeAdvanced {
func (p *PPageQRCodeAdvanced) SetMask(mask int) *PPageQRCodeAdvanced {
func (p *PPageQRCodeAdvanced) Header() []byte {
func (p *PPageQRCodeAdvanced) Clause() *command.Clause {
page_elements.go — 1C 4C 42

完整参数、默认值与命令编码

type PPageBar struct {
BasePOSArg
X int // 条码起始X坐标
Y int // 条码起始Y坐标
CodeType int // 条码类型
Height int // 条码高度
Readable int // 是否显示可读文字
Rotation types.Rotation // 旋转角度
Narrow int // 窄条宽度
Wide int // 宽条宽度
Content string // 条码内容
}
func NewPPageBar() *PPageBar {
func (p *PPageBar) SetPosition(x, y int) *PPageBar {
func (p *PPageBar) SetCodeType(codeType int) *PPageBar {
func (p *PPageBar) SetHeight(height int) *PPageBar {
func (p *PPageBar) SetReadable(readable int) *PPageBar {
func (p *PPageBar) SetRotation(rotation types.Rotation) *PPageBar {
func (p *PPageBar) SetWidth(narrow, wide int) *PPageBar {
func (p *PPageBar) SetContent(content string) *PPageBar {
func (p *PPageBar) Header() []byte {
func (p *PPageBar) Clause() *command.Clause {
type PPageImage struct {
BasePOSArg
X int // 图片起始X坐标
Y int // 图片起始Y坐标
Width int // 图片宽度
Height int // 图片高度
Rotation types.Rotation // 旋转角度
ImageData []byte // 图片数据
}
func NewPPageImage() *PPageImage {
func (p *PPageImage) SetPosition(x, y int) *PPageImage {
func (p *PPageImage) SetSize(width, height int) *PPageImage {
func (p *PPageImage) SetRotation(rotation types.Rotation) *PPageImage {
func (p *PPageImage) SetImageData(data []byte) *PPageImage {
func (p *PPageImage) Header() []byte {
func (p *PPageImage) Clause() *command.Clause {
type PPageTextBar struct {
BasePOSArg
X int // 起始X坐标
Y int // 起始Y坐标
Text string // 文本内容
BarCode string // 条码内容
Rotation types.Rotation // 旋转角度
}
func NewPPageTextBar() *PPageTextBar {
func (p *PPageTextBar) SetPosition(x, y int) *PPageTextBar {
func (p *PPageTextBar) SetText(text string) *PPageTextBar {
func (p *PPageTextBar) SetBarCode(barCode string) *PPageTextBar {
func (p *PPageTextBar) SetRotation(rotation types.Rotation) *PPageTextBar {
func (p *PPageTextBar) Header() []byte {
func (p *PPageTextBar) Clause() *command.Clause {
position.go — 1B 24

完整参数、默认值与命令编码

type PAbsPosition struct {
BasePOSArg
Value int // 绝对位置值
}
func NewPAbsPosition() *PAbsPosition {
func (p *PAbsPosition) SetValue(value int) *PAbsPosition {
func (p *PAbsPosition) Header() []byte {
func (p *PAbsPosition) Clause() *command.Clause {
type PRelPosition struct {
BasePOSArg
Value int // 相对位置值
}
func NewPRelPosition() *PRelPosition {
func (p *PRelPosition) SetValue(value int) *PRelPosition {
func (p *PRelPosition) Header() []byte {
func (p *PRelPosition) Clause() *command.Clause {
type PLeftMargin struct {
BasePOSArg
Margin int // 左边距值
}
func NewPLeftMargin() *PLeftMargin {
func (p *PLeftMargin) SetMargin(margin int) *PLeftMargin {
func (p *PLeftMargin) Header() []byte {
func (p *PLeftMargin) Clause() *command.Clause {
type PLocation struct {
BasePOSArg
X int // X坐标
Y int // Y坐标
}
func NewPLocation() *PLocation {
func (p *PLocation) SetLocation(x, y int) *PLocation {
func (p *PLocation) Header() []byte {
func (p *PLocation) Clause() *command.Clause {
print.go — 0C

完整参数、默认值与命令编码

type PPrint struct {
BasePOSArg
}
func NewPPrint() *PPrint {
func (p *PPrint) Header() []byte {
func (p *PPrint) Clause() *command.Clause {
type PFeed struct {
BasePOSArg
Lines int // 进纸行数
}
func NewPFeed() *PFeed {
func (p *PFeed) SetLines(lines int) *PFeed {
func (p *PFeed) Header() []byte {
func (p *PFeed) Clause() *command.Clause {
type PLineDot struct {
BasePOSArg
Dots int // 进纸点数
}
func NewPLineDot() *PLineDot {
func (p *PLineDot) SetDots(dots int) *PLineDot {
func (p *PLineDot) Header() []byte {
func (p *PLineDot) Clause() *command.Clause {
type PPage struct {
BasePOSArg
}
func NewPPage() *PPage {
func (p *PPage) Header() []byte {
func (p *PPage) Clause() *command.Clause {
style.go — 1B 45

完整参数、默认值与命令编码

type PBold struct {
BasePOSArg
Bold bool // 是否加粗
}
func NewPBold() *PBold {
func (p *PBold) SetBold(bold bool) *PBold {
func (p *PBold) Header() []byte {
func (p *PBold) Clause() *command.Clause {
type PUnderline struct {
BasePOSArg
Underline bool // 是否下划线
}
func NewPUnderline() *PUnderline {
func (p *PUnderline) SetUnderline(underline bool) *PUnderline {
func (p *PUnderline) Header() []byte {
func (p *PUnderline) Clause() *command.Clause {
type PDouble struct {
BasePOSArg
DoubleWidth bool // 双倍宽度
DoubleHeight bool // 双倍高度
}
func NewPDouble() *PDouble {
func (p *PDouble) SetDoubleWidth(doubleWidth bool) *PDouble {
func (p *PDouble) SetDoubleHeight(doubleHeight bool) *PDouble {
func (p *PDouble) Header() []byte {
func (p *PDouble) Clause() *command.Clause {
type PReverse struct {
BasePOSArg
Reverse bool // 是否反向
}
func NewPReverse() *PReverse {
func (p *PReverse) SetReverse(reverse bool) *PReverse {
func (p *PReverse) Header() []byte {
func (p *PReverse) Clause() *command.Clause {
text.go — 1C 4C 54

完整参数、默认值与命令编码

type PPageText struct {
BasePOSArg
X int // x坐标
Y int // y坐标
Rotation types.Rotation // 旋转角度
Content string // 文本内容
}
func NewPPageText() *PPageText {
func (p *PPageText) SetPosition(x, y int) *PPageText {
func (p *PPageText) SetRotation(rotation types.Rotation) *PPageText {
func (p *PPageText) SetContent(content string) *PPageText {
func (p *PPageText) Header() []byte {
func (p *PPageText) Clause() *command.Clause {
type PLF struct {
BasePOSArg
}
func NewPLF() *PLF {
func (p *PLF) Header() []byte {
func (p *PLF) Clause() *command.Clause {
type PCR struct {
BasePOSArg
}
func NewPCR() *PCR {
func (p *PCR) Header() []byte {
func (p *PCR) Clause() *command.Clause {
printer_type.go

完整参数、默认值与命令编码

type POSPrinter int
const (
func (p POSPrinter) String() string {
type Rotation int
const (
func (r Rotation) GetRotation() int {
type Level int
const (
func (l Level) String() string {
PAbsPosition.java — 1B 24

完整参数、默认值与命令编码

public class PAbsPosition extends BasicPOSArg<PAbsPosition> {
private int value;
public byte[] header() {
public CommandClause clause() {
PBarCode.java — 1B 4D

完整参数、默认值与命令编码

public class PBarCode extends BasicPOSArg<PBarCode> {
private String content;
private int height;
private CodeType codeType = CodeType.CODE128;
private HRI hri = HRI.SHOW_NONE;
public byte[] header() {
public CommandClause clause() {
PBatteryVolume.java — 10 FF 50 F1

完整参数、默认值与命令编码

public class PBatteryVolume extends OnlyBinaryHeaderArg<PBatteryVolume> implements BasicBatteryVolumeArg<byte[]> {
public byte[] header() {
PBold.java — 1B 45

完整参数、默认值与命令编码

public class PBold extends BasicPOSArg<PBold> {
private boolean bold = false;
public byte[] header() {
public CommandClause clause() {
PCR.java — 0A 0D

完整参数、默认值与命令编码

public class PCR extends OnlyBinaryHeaderArg<PCR> {
public byte[] header() {
PCharSpace.java — 1B 20

完整参数、默认值与命令编码

public class PCharSpace extends BasicPOSArg<PCharSpace> {
private int dot;
public byte[] header() {
public CommandClause clause() {
PDouble.java — 1B 47

完整参数、默认值与命令编码

public class PDouble extends BasicPOSArg<PDouble> {
private boolean model = false;
public byte[] header() {
public CommandClause clause() {
PFeed.java — 0C

完整参数、默认值与命令编码

public class PFeed extends OnlyBinaryHeaderArg<PFeed> {
public byte[] header() {
PFont.java — 1B 4D

完整参数、默认值与命令编码

public class PFont extends BasicPOSArg<PFont> {
private Font font=Font.TSS16;
public byte[] header() {
public CommandClause clause() {
PFontSize.java — 1D 21

完整参数、默认值与命令编码

public class PFontSize extends BasicPOSArg<PFontSize> {
private FontSize width = FontSize.NORMAL;
private FontSize height = FontSize.NORMAL;
public byte[] header() {
public CommandClause clause() {
PImage.java — 1F 00 1D 76 30

完整参数、默认值与命令编码

public class PImage<T extends ISourceImage> extends BasicPOSArg<PImage<T>> {
private T image;
private Mode mode = Mode.NORMAL;
private boolean compress;
private boolean reverse;
private int grayThreshold = 190;
public byte[] header() {
public CommandClause clause() {
public enum Mode {
private final int mode;
public int getMode() {
PLF.java — 0A

完整参数、默认值与命令编码

public class PLF extends OnlyBinaryHeaderArg<PLF> {
public byte[] header() {
PLeftMargin.java — 1D 4C

完整参数、默认值与命令编码

public class PLeftMargin extends BasicPOSArg<PLeftMargin> {
private int dot;
public byte[] header() {
public CommandClause clause() {
PLine.java — 1C 4C 6C

完整参数、默认值与命令编码

public class PLine extends BasicPOSArg<PLine> implements BasicLineArg<byte[]> {
private int startX;
private int startY;
private int endX;
private int endY;
private int width;
public byte[] header() {
public CommandClause clause() {
PLineChar.java — 1B 64

完整参数、默认值与命令编码

public class PLineChar extends BasicPOSArg<PLineChar> {
private int row;
public byte[] header() {
public CommandClause clause() {
PLineDot.java — 1B 4A

完整参数、默认值与命令编码

public class PLineDot extends BasicPOSArg<PLineDot> {
private int dot;
public byte[] header() {
public CommandClause clause() {
PLineSpace.java — 1B 33

完整参数、默认值与命令编码

public class PLineSpace extends BasicPOSArg<PLineSpace> {
private int distance;
public byte[] header() {
public CommandClause clause() {
PLocation.java — 1B 61

完整参数、默认值与命令编码

public class PLocation extends BasicPOSArg<PLocation> {
private Location location=Location.LEFT;
public byte[] header() {
public CommandClause clause() {
PPage.java — 1C 4C 70

完整参数、默认值与命令编码

public class PPage extends BasicPOSArg<PPage> {
private int width;//打印区域宽度
private int height;//打印区域高度
public byte[] header() {
public CommandClause clause() {
PPageBar.java — 1C 4C 62

完整参数、默认值与命令编码

public class PPageBar extends BasicPOSArg<PPageBar> {
private CodeType codeType = CodeType.CODE128;
private int x;
private int y;
private String content;
private Rotation rotation = Rotation.ROTATION_0;
private int width;
private int height;
public byte[] header() {
public CommandClause clause() {
PPageImage.java — 1C 4C 6D

完整参数、默认值与命令编码

public class PPageImage<T extends ISourceImage> extends BasicPOSArg<PPageImage<T>> {
private T image;
private int width;
private int height;
private int x;
private int y;
private int grayThreshold = 190;
public byte[] header() {
public CommandClause clause() {
PPagePDF.java — 1C 4C 42

完整参数、默认值与命令编码

public class PPagePDF extends BasicPOSArg<PPagePDF> {
private int x;
private int y;
private int width;
private Rotation rotation = Rotation.ROTATION_0;
private String content;
public byte[] header() {
public CommandClause clause() {
PPageQRCode.java — 1C 4C 42

完整参数、默认值与命令编码

public class PPageQRCode extends BasicPOSArg<PPageQRCode> {
private int x;
private int y;
private int ver;
private Level level = Level.L;
private Rotation rotation = Rotation.ROTATION_0;
private String content;
public byte[] header() {
public CommandClause clause() {
PPageText.java — 1C 4C 74

完整参数、默认值与命令编码

public class PPageText extends BasicPOSArg<PPageText> {
private PageFont font = PageFont.TSS24;
private int x;
private int y;
private String content;
private Rotation rotation = Rotation.ROTATION_0;
private boolean bold;
private boolean underline;
private boolean reverse;
public byte[] header() {
public CommandClause clause() {
PPageTextBar.java — 1C 4C 54

完整参数、默认值与命令编码

public class PPageTextBar extends BasicPOSArg<PPageTextBar> {
private PageFont font=PageFont.TSS24;
private int x;
private int y;
private int width;
private int height;
private String content;
private Rotation rotation=Rotation.ROTATION_0;
private boolean bold;
private boolean underline;
private boolean reverse;
public byte[] header() {
public CommandClause clause() {
PPicFlash.java — 1C 70

完整参数、默认值与命令编码

public class PPicFlash extends BasicPOSArg<PPicFlash> {
private int index;
private PicMode picMode=PicMode.NORMAL;
public byte[] header() {
public CommandClause clause() {
PPrint.java — 1C 4C 6F

完整参数、默认值与命令编码

public class PPrint extends BasicPOSArg<PPrint> {
private boolean feed = false;//是否定位到缝隙
private Mode mode = Mode.NORMAL;
public enum Mode {
private final int mode;
public int getMode() {
public byte[] header() {
public CommandClause clause() {
PQRCode.java — 1D 6C

完整参数、默认值与命令编码

public class PQRCode extends BasicPOSArg<PQRCode> {
private int ver;
private Level level = Level.L;
private String content;
public byte[] header() {
public CommandClause clause() {
PRelPosition.java — 1B 5C

完整参数、默认值与命令编码

public class PRelPosition extends BasicPOSArg<PRelPosition> {
private int value;
public byte[] header() {
public CommandClause clause() {
PReverse.java — 1C 4C 72

完整参数、默认值与命令编码

public class PReverse extends BasicPOSArg<PReverse> implements BasicLineArg<byte[]> {
private int startX;
private int startY;
private int endX;
private int endY;
private boolean reverse;
public byte[] header() {
public CommandClause clause() {
PRotation.java — 1B 56

完整参数、默认值与命令编码

public class PRotation extends BasicPOSArg<PRotation> {
private Rotation rotation=Rotation.ROTATION_0;
public byte[] header() {
public CommandClause clause() {
PUnderline.java — 1B 45

完整参数、默认值与命令编码

public class PUnderline extends BasicPOSArg<PUnderline> {
private boolean underline = false;
public byte[] header() {
public CommandClause clause() {
CodeType.java

完整参数、默认值与命令编码

public enum CodeType {
private final int type;
private final int pageType;
public int getType() {
public int getPageType() {
Font.java

完整参数、默认值与命令编码

public enum Font {
private final int font;
public int getFont() {
FontSize.java

完整参数、默认值与命令编码

public enum FontSize {
private final int FontSize;
public int getFontSize() {
HRI.java

完整参数、默认值与命令编码

public enum HRI {
private final int hri;
public int getHri() {
Level.java

完整参数、默认值与命令编码

public enum Level {
private final int levelNum;
public int getLevelNum() {
Location.java

完整参数、默认值与命令编码

public enum Location {
private final int location;
public int getLocation() {
PageFont.java

完整参数、默认值与命令编码

public enum PageFont {
private final int font;
public int getFont() {
PicMode.java

完整参数、默认值与命令编码

public enum PicMode {
private final int picMode;
public int getPicMode() {
Rotation.java

完整参数、默认值与命令编码

public enum Rotation {
private final int rotation;
public int getRotation() {