@connexup/react-native-xprinter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/LICENSE +20 -0
  2. package/NativeXPrinter.podspec +23 -0
  3. package/README.md +24 -0
  4. package/android/build.gradle +73 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/libs/printer-lib-3.4.7.aar +0 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/java/com/connexup/xprinter/Errors.kt +11 -0
  9. package/android/src/main/java/com/connexup/xprinter/Util.kt +106 -0
  10. package/android/src/main/java/com/connexup/xprinter/XPrinterPackage.kt +77 -0
  11. package/android/src/main/java/com/connexup/xprinter/esc/Convert.kt +211 -0
  12. package/android/src/main/java/com/connexup/xprinter/esc/XPrinterESCModule.kt +1995 -0
  13. package/android/src/main/java/com/connexup/xprinter/printer/Convert.kt +46 -0
  14. package/android/src/main/java/com/connexup/xprinter/printer/DeviceConnection.kt +14 -0
  15. package/android/src/main/java/com/connexup/xprinter/printer/Printers.kt +153 -0
  16. package/android/src/main/java/com/connexup/xprinter/printer/XPrinterPrinterModule.kt +295 -0
  17. package/android/src/main/java/com/connexup/xprinter/tspl/Convert.kt +151 -0
  18. package/android/src/main/java/com/connexup/xprinter/tspl/XPrinterTSPLModule.kt +1408 -0
  19. package/android/src/main/java/com/connexup/xprinter/utils/XPrinterUtilsModule.kt +54 -0
  20. package/ios/ESC/ESCConvert.swift +283 -0
  21. package/ios/ESC/Models/RCTESCPrintBarCodeRequest.swift +23 -0
  22. package/ios/ESC/Models/RCTESCPrintBitmapRequest.swift +23 -0
  23. package/ios/ESC/Models/RCTESCPrintPDF417Request.swift +27 -0
  24. package/ios/ESC/Models/RCTESCPrintQRCodeRequest.swift +19 -0
  25. package/ios/ESC/Models/RCTESCPrintTableBarcode.swift +23 -0
  26. package/ios/ESC/Models/RCTESCPrintTableRequest.swift +19 -0
  27. package/ios/ESC/Models/RCTESCPrintTableRow.swift +19 -0
  28. package/ios/ESC/Models/RCTESCPrintTextRequest.swift +21 -0
  29. package/ios/ESC/Models/RCTESCPrintTextSizeRequest.swift +17 -0
  30. package/ios/ESC/Models/RCTESCSelectBitmapModelRequest.swift +17 -0
  31. package/ios/ESC/Models/RCTESCSetNetAllRequest.swift +19 -0
  32. package/ios/ESC/Models/RCTESCSetPrintAreaRequest.swift +19 -0
  33. package/ios/ESC/Models/RCTESCSetTextStyleRequest.swift +17 -0
  34. package/ios/ESC/Models/RCTESCWifiConfigRequest.swift +23 -0
  35. package/ios/ESC/NativeXPrinterESC.swift +1339 -0
  36. package/ios/ESC/RCTNativeXPrinterESC.h +10 -0
  37. package/ios/ESC/RCTNativeXPrinterESC.mm +541 -0
  38. package/ios/Errors.swift +11 -0
  39. package/ios/NativeErrorInfo.swift +21 -0
  40. package/ios/Printer/Connecter.swift +214 -0
  41. package/ios/Printer/Models/RCTDeviceConnectStatusChangeEvent.swift +19 -0
  42. package/ios/Printer/Models/RCTNetDevice.swift +21 -0
  43. package/ios/Printer/Models/RCTUSBDevice.swift +17 -0
  44. package/ios/Printer/Models/RCTUpdateUdpNetConfigRequest.swift +21 -0
  45. package/ios/Printer/NativeXPrinterPrinter.swift +209 -0
  46. package/ios/Printer/Printers.swift +59 -0
  47. package/ios/Printer/RCTNativeXPrinterPrinter.h +12 -0
  48. package/ios/Printer/RCTNativeXPrinterPrinter.mm +123 -0
  49. package/ios/PrinterSDK/Headers/CPCLCommand.h +324 -0
  50. package/ios/PrinterSDK/Headers/KDS_Log.h +47 -0
  51. package/ios/PrinterSDK/Headers/LabelDocument.h +32 -0
  52. package/ios/PrinterSDK/Headers/LabelImageTranster.h +19 -0
  53. package/ios/PrinterSDK/Headers/POSBLEManager.h +164 -0
  54. package/ios/PrinterSDK/Headers/POSCommand.h +760 -0
  55. package/ios/PrinterSDK/Headers/POSImageTranster.h +34 -0
  56. package/ios/PrinterSDK/Headers/POSPrinter.h +47 -0
  57. package/ios/PrinterSDK/Headers/POSPrinterSDK.h +13 -0
  58. package/ios/PrinterSDK/Headers/POSWIFIManager.h +162 -0
  59. package/ios/PrinterSDK/Headers/PTable.h +50 -0
  60. package/ios/PrinterSDK/Headers/PrinterProfile.h +28 -0
  61. package/ios/PrinterSDK/Headers/TSCBLEManager.h +142 -0
  62. package/ios/PrinterSDK/Headers/TSCCommand.h +701 -0
  63. package/ios/PrinterSDK/Headers/TSCPrinterSDK.h +15 -0
  64. package/ios/PrinterSDK/Headers/TSCWIFIManager.h +99 -0
  65. package/ios/PrinterSDK/Headers/WIFIConnecter.h +131 -0
  66. package/ios/PrinterSDK/Headers/ZPLCommand.h +372 -0
  67. package/ios/PrinterSDK/libPrinterSDK.a +0 -0
  68. package/ios/TSPL/Models/RCTTSPLBarRequest.swift +19 -0
  69. package/ios/TSPL/Models/RCTTSPLBarcodeRequest.swift +29 -0
  70. package/ios/TSPL/Models/RCTTSPLBitmapCompressionRequest.swift +25 -0
  71. package/ios/TSPL/Models/RCTTSPLBitmapRequest.swift +25 -0
  72. package/ios/TSPL/Models/RCTTSPLBoxRequest.swift +21 -0
  73. package/ios/TSPL/Models/RCTTSPLEraseRequest.swift +19 -0
  74. package/ios/TSPL/Models/RCTTSPLPDFBase64Request.swift +21 -0
  75. package/ios/TSPL/Models/RCTTSPLPutBMPRequest.swift +17 -0
  76. package/ios/TSPL/Models/RCTTSPLQRCodeRequest.swift +29 -0
  77. package/ios/TSPL/Models/RCTTSPLReverseRequest.swift +19 -0
  78. package/ios/TSPL/Models/RCTTSPLTextRequest.swift +25 -0
  79. package/ios/TSPL/NativeXPrinterTSPL.swift +831 -0
  80. package/ios/TSPL/RCTNativeXPrinterTSPL.h +10 -0
  81. package/ios/TSPL/RCTNativeXPrinterTSPL.mm +445 -0
  82. package/ios/TSPL/TSPLConvert.swift +140 -0
  83. package/ios/Utils/Models/RCTCheckIsPureWhiteImageRequest.swift +16 -0
  84. package/ios/Utils/NativeXPrinterUtils.swift +17 -0
  85. package/ios/Utils/RCTNativeXPrinterUtils.h +10 -0
  86. package/ios/Utils/RCTNativeXPrinterUtils.mm +38 -0
  87. package/ios/Utils.swift +126 -0
  88. package/lib/module/esc/NativeXPrinterESC.js +218 -0
  89. package/lib/module/esc/NativeXPrinterESC.js.map +1 -0
  90. package/lib/module/esc/index.js +324 -0
  91. package/lib/module/esc/index.js.map +1 -0
  92. package/lib/module/index.js +8 -0
  93. package/lib/module/index.js.map +1 -0
  94. package/lib/module/package.json +1 -0
  95. package/lib/module/printer/NativeXPrinterPrinter.js +30 -0
  96. package/lib/module/printer/NativeXPrinterPrinter.js.map +1 -0
  97. package/lib/module/printer/index.js +110 -0
  98. package/lib/module/printer/index.js.map +1 -0
  99. package/lib/module/tspl/NativeXPrinterTSPL.js +143 -0
  100. package/lib/module/tspl/NativeXPrinterTSPL.js.map +1 -0
  101. package/lib/module/tspl/index.js +347 -0
  102. package/lib/module/tspl/index.js.map +1 -0
  103. package/lib/module/type.js +12 -0
  104. package/lib/module/type.js.map +1 -0
  105. package/lib/module/util.js +4 -0
  106. package/lib/module/util.js.map +1 -0
  107. package/lib/module/utils/NativeXPrinterUtils.js +5 -0
  108. package/lib/module/utils/NativeXPrinterUtils.js.map +1 -0
  109. package/lib/module/utils/index.js +17 -0
  110. package/lib/module/utils/index.js.map +1 -0
  111. package/lib/typescript/package.json +1 -0
  112. package/lib/typescript/src/esc/NativeXPrinterESC.d.ts +343 -0
  113. package/lib/typescript/src/esc/NativeXPrinterESC.d.ts.map +1 -0
  114. package/lib/typescript/src/esc/index.d.ts +122 -0
  115. package/lib/typescript/src/esc/index.d.ts.map +1 -0
  116. package/lib/typescript/src/index.d.ts +6 -0
  117. package/lib/typescript/src/index.d.ts.map +1 -0
  118. package/lib/typescript/src/printer/NativeXPrinterPrinter.d.ts +61 -0
  119. package/lib/typescript/src/printer/NativeXPrinterPrinter.d.ts.map +1 -0
  120. package/lib/typescript/src/printer/index.d.ts +32 -0
  121. package/lib/typescript/src/printer/index.d.ts.map +1 -0
  122. package/lib/typescript/src/tspl/NativeXPrinterTSPL.d.ts +261 -0
  123. package/lib/typescript/src/tspl/NativeXPrinterTSPL.d.ts.map +1 -0
  124. package/lib/typescript/src/tspl/index.d.ts +128 -0
  125. package/lib/typescript/src/tspl/index.d.ts.map +1 -0
  126. package/lib/typescript/src/type.d.ts +9 -0
  127. package/lib/typescript/src/type.d.ts.map +1 -0
  128. package/lib/typescript/src/util.d.ts +2 -0
  129. package/lib/typescript/src/util.d.ts.map +1 -0
  130. package/lib/typescript/src/utils/NativeXPrinterUtils.d.ts +10 -0
  131. package/lib/typescript/src/utils/NativeXPrinterUtils.d.ts.map +1 -0
  132. package/lib/typescript/src/utils/index.d.ts +9 -0
  133. package/lib/typescript/src/utils/index.d.ts.map +1 -0
  134. package/package.json +178 -0
  135. package/src/esc/NativeXPrinterESC.ts +516 -0
  136. package/src/esc/index.ts +489 -0
  137. package/src/index.ts +5 -0
  138. package/src/printer/NativeXPrinterPrinter.ts +84 -0
  139. package/src/printer/index.ts +160 -0
  140. package/src/tspl/NativeXPrinterTSPL.ts +388 -0
  141. package/src/tspl/index.ts +535 -0
  142. package/src/type.ts +11 -0
  143. package/src/util.ts +1 -0
  144. package/src/utils/NativeXPrinterUtils.ts +14 -0
  145. package/src/utils/index.ts +27 -0
@@ -0,0 +1,99 @@
1
+ //
2
+ // TSCWIFIManager.h
3
+ // Printer
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+
8
+ typedef void(^TSCWIFIManagerReceiveBlock)(NSData *data);
9
+ typedef void(^TSCWIFIManagerWriteBlock)(long tag);
10
+ typedef void (^TSCWIFIPrinterStatusBlock)(NSData *status);
11
+
12
+ @class TSCWIFIManager;
13
+ @protocol TSCWIFIManagerDelegate <NSObject>
14
+ @optional
15
+ /**
16
+ * connect success
17
+ */
18
+ - (void)TSCwifiConnectedToHost:(NSString *)host port:(UInt16)port;
19
+ /**
20
+ * disconnect error
21
+ */
22
+ - (void)TSCwifiDisconnectWithError:(NSError *)error;
23
+ /**
24
+ * send data success
25
+ */
26
+ - (void)TSCwifiWriteValueWithTag:(long)tag;
27
+ /**
28
+ * receive printer data
29
+ */
30
+ - (void)TSCwifiReceiveValueForData:(NSData *)data;
31
+ @end
32
+
33
+ @interface TSCWIFIManager : NSObject
34
+ // host
35
+ @property (nonatomic, copy) NSString *hostStr;
36
+ // port
37
+ @property (nonatomic, assign) UInt16 port;
38
+ // connect status
39
+ @property (nonatomic, assign) BOOL isConnect;
40
+
41
+ @property (nonatomic, weak) id<TSCWIFIManagerDelegate> delegate;
42
+
43
+ @property (nonatomic, copy) TSCWIFIManagerReceiveBlock receiveBlock;
44
+
45
+ @property (nonatomic, copy) TSCWIFIManagerWriteBlock writeBlock;
46
+
47
+ @property (nonatomic, copy) TSCWIFIPrinterStatusBlock statusBlock;
48
+
49
+ /**
50
+ * singleton
51
+ */
52
+ + (instancetype)sharedInstance;
53
+
54
+ /**
55
+ * connect printer address
56
+ */
57
+ - (void)connectWithHost:(NSString *)hostStr port:(UInt16)port;
58
+
59
+ /**
60
+ * disconnect
61
+ */
62
+ - (void)disconnect;
63
+
64
+ /**
65
+ * write command to printer
66
+ */
67
+ - (void)writeCommandWithData:(NSData *)data;
68
+
69
+ /**
70
+ * remove a delegate
71
+ */
72
+ - (void)removeDelegate:(id<TSCWIFIManagerDelegate>) delegate;
73
+
74
+ /**
75
+ * remove all delegates
76
+ */
77
+ - (void)removeAllDelegates;
78
+
79
+ /**
80
+ * write command to printer with receive callback
81
+ */
82
+ - (void)writeCommandWithData:(NSData *)data receiveCallBack:(TSCWIFIManagerReceiveBlock)receiveBlock;
83
+
84
+ /**
85
+ * write command to printer with write callback
86
+ */
87
+ - (void)writeCommandWithData:(NSData *)data writeCallBack:(TSCWIFIManagerWriteBlock)writeBlock;
88
+
89
+ /**
90
+ * printer status
91
+ */
92
+ - (void)printerStatus:(TSCWIFIPrinterStatusBlock)statusBlock;
93
+
94
+ /**
95
+ * get copyright
96
+ */
97
+ + (NSString *)GetCopyRight;
98
+
99
+ @end
@@ -0,0 +1,131 @@
1
+ //
2
+ // WIFIConnecter.h
3
+ // PrinterSDK
4
+ //
5
+ // Created by Apple Mac mini intel on 2023/9/1.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <UIKit/UIKit.h>
10
+ #import "PrinterProfile.h"
11
+
12
+ @class WIFIConnecter;
13
+ @class PrinterProfile;
14
+
15
+ @protocol WIFIConnecterDelegate <NSObject>
16
+ @optional
17
+ /**
18
+ * connect success
19
+ */
20
+ - (void)wifiPOSConnectedToHost:(NSString *)ip port:(UInt16)port mac:(NSString *)mac;
21
+ /**
22
+ * disconnect error
23
+ */
24
+ - (void)wifiPOSDisconnectWithError:(NSError *)error mac:(NSString *)mac ip:(NSString *)ip;
25
+ /**
26
+ * send data success
27
+ */
28
+ - (void)wifiPOSWriteValueWithTag:(long)tag mac:(NSString *)mac ip:(NSString *)ip;
29
+ /**
30
+ * receive printer data
31
+ */
32
+ - (void)wifiPOSReceiveValueForData:(NSData *)data mac:(NSString *)mac ip:(NSString *)ip;
33
+
34
+ @end
35
+
36
+ /**********************************************************************/
37
+
38
+ typedef void (^WIFIConnecterReceiveBlock)(NSData *data);
39
+ typedef void (^WIFIConnecterWriteBlock)(BOOL success, NSError *error);
40
+ typedef void (^POSWiFiPrinterStatusBlock)(NSData *status);
41
+ typedef void (^POSWiFiPrinterSNBlock)(NSString *sn);
42
+
43
+ /**********************************************************************/
44
+
45
+ @interface WIFIConnecter : NSObject
46
+ // host
47
+ @property (nonatomic, copy) NSString *deviceIP;
48
+ // port
49
+ @property (nonatomic, assign) UInt16 port;
50
+ // mac
51
+ @property (nonatomic, copy) NSString *deviceMac;
52
+
53
+ @property (nonatomic, weak) id<WIFIConnecterDelegate> delegate;
54
+ @property (nonatomic, copy) WIFIConnecterReceiveBlock receiveBlock;
55
+ @property (nonatomic, copy) WIFIConnecterWriteBlock writeBlock;
56
+ @property (nonatomic, copy) POSWiFiPrinterStatusBlock statusBlock;
57
+ @property (nonatomic, copy) POSWiFiPrinterSNBlock snBlock;
58
+ @property (nonatomic, strong) PrinterProfile *connectedPrinter;
59
+
60
+ /**
61
+ * remove a delegate
62
+ */
63
+ - (void)removeDelegate:(id<WIFIConnecterDelegate>) delegate;
64
+
65
+ /**
66
+ * remove all delegates
67
+ */
68
+ - (void)removeAllDelegates;
69
+
70
+ /**
71
+ * disconnect
72
+ */
73
+ - (void)disconnect;
74
+
75
+ /**
76
+ * write command to printer
77
+ */
78
+ - (void)writeCommandWithData:(NSData *)data;
79
+
80
+ /**
81
+ * write command to printer with receive callback
82
+ */
83
+ - (void)writeCommandWithData:(NSData *)data receiveCallBack:(WIFIConnecterReceiveBlock)receiveBlock;
84
+
85
+ /**
86
+ * write command to printer with write callback
87
+ */
88
+ - (void)writeCommandWithData:(NSData *)data writeCallBack:(WIFIConnecterWriteBlock)writeBlock;
89
+
90
+ /**
91
+ * write command to printer with subpackage with write callback
92
+ */
93
+ - (void)writeCommandWithData:(NSData *)data subpackageLength:(int)subpackageLength writeCallBack:(WIFIConnecterWriteBlock)writeBlock;
94
+
95
+ /**
96
+ * check connect status
97
+ */
98
+ - (BOOL)printerCheckWithMac;
99
+
100
+ /**
101
+ * printer status
102
+ */
103
+ - (void)printerStatus:(POSWiFiPrinterStatusBlock)statusBlock;
104
+
105
+ /**
106
+ * printer sn code
107
+ */
108
+ - (void)printerSNWithSnBlock:(POSWiFiPrinterSNBlock)snBlock;
109
+
110
+ /**
111
+ * connect printer address
112
+ */
113
+ - (void)connectWithHost:(NSString *)hostStr port:(UInt16)port;
114
+
115
+ /**
116
+ * connect printer address with mac address
117
+ */
118
+ - (void)connectWithMac:(NSString *)mac;
119
+
120
+ /**
121
+ * connect printer by device profile
122
+ */
123
+ - (void)connectWithDevice:(PrinterProfile *)device;
124
+
125
+ /**
126
+ * printer label status
127
+ */
128
+ - (void)labelPrinterStatus:(POSWiFiPrinterStatusBlock)statusBlock;
129
+
130
+ @end
131
+
@@ -0,0 +1,372 @@
1
+ //
2
+ // ZPLCommand.h
3
+ // Printer
4
+ //
5
+ // Created by apple on 2022/9/20.
6
+ // Copyright © 2022 Admin. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import <UIKit/UIKit.h>
11
+
12
+ //Rotation
13
+ typedef NS_ENUM(NSInteger, ZPLRotation) {
14
+ ROTATION_0 = 0,
15
+ ROTATION_90,
16
+ ROTATION_180,
17
+ ROTATION_270
18
+ };
19
+
20
+ //Font
21
+ typedef NS_ENUM(NSInteger, ZPLFont) {
22
+ FNT_9_5 = 0,
23
+ FNT_11_7,
24
+ FNT_18_10,
25
+ FNT_42_20,
26
+ FNT_26_13,
27
+ FNT_60_40,
28
+ FNT_34_22,
29
+ FNT_24_24,
30
+ FNT_20_18,
31
+ FNT_28_24,
32
+ FNT_35_31,
33
+ FNT_40_35,
34
+ FNT_48_42,
35
+ FNT_59_53,
36
+ FNT_80_71,
37
+ FNT_15_12
38
+ };
39
+
40
+ //CodeType
41
+ typedef NS_ENUM(NSInteger, ZPLBarCode) {
42
+ CODE_TYPE_11 = 0,
43
+ CODE_TYPE_25,
44
+ CODE_TYPE_39,
45
+ CODE_TYPE_EAN8,
46
+ CODE_TYPE_UPCE,
47
+ CODE_TYPE_93,
48
+ CODE_TYPE_128,
49
+ CODE_TYPE_EAN13,
50
+ CODE_TYPE_CODA,
51
+ CODE_TYPE_MSI,
52
+ CODE_TYPE_PLESSEY,
53
+ CODE_TYPE_UPCEAN,
54
+ CODE_TYPE_UPCA
55
+ };
56
+
57
+ //HriText
58
+ typedef NS_ENUM(NSInteger, ZPLHriText) {
59
+ HRI_TEXT_NONE = 0,
60
+ HRI_TEXT_BELOW,
61
+ HRI_TEXT_ABOVE
62
+ };
63
+
64
+ //CodePage
65
+ typedef NS_ENUM(NSInteger, ZPLCodePage) {
66
+ CODE_PAGE_USA1 = 0,
67
+ CODE_PAGE_USA2 = 1,
68
+ CODE_PAGE_UK = 2,
69
+ CODE_PAGE_NL = 3,
70
+ CODE_PAGE_DK = 4,
71
+ CODE_PAGE_SWEDE = 5,
72
+ CODE_PAGE_GER = 6,
73
+ CODE_PAGE_FR1 = 7,
74
+ CODE_PAGE_FR2 = 8,
75
+ CODE_PAGE_ITA = 9,
76
+ CODE_PAGE_ES = 10,
77
+ CODE_PAGE_JA = 12,
78
+ CODE_PAGE_UTF8 = 28,
79
+ CODE_PAGE_UTF16_BIG = 29,
80
+ CODE_PAGE_UTF16_LITTLE = 30
81
+ };
82
+
83
+ NS_ASSUME_NONNULL_BEGIN
84
+
85
+ @interface ZPLCommand : NSObject
86
+
87
+ /**
88
+ * 命令开始
89
+ * ^XA
90
+ * @return data
91
+ */
92
+ + (NSData *)XA;
93
+
94
+ /**
95
+ * 命令结束
96
+ * ^XZ
97
+ * @return data
98
+ */
99
+ + (NSData *)XZ;
100
+
101
+ /**
102
+ * 设置标签宽度
103
+ * @param width label width
104
+ * @return data
105
+ */
106
+ + (NSData *)setLabelWidth:(int)width;
107
+
108
+ /**
109
+ * 设置标签长度
110
+ * @param height label height
111
+ * @return data
112
+ */
113
+ + (NSData *)setLabelHeight:(int)height;
114
+
115
+ /**
116
+ * 设置标签浓度
117
+ * @param density label density
118
+ * @return data
119
+ */
120
+ + (NSData *)setDensity:(int)density;
121
+
122
+ /**
123
+ * 设置标签速度
124
+ * @param speed 打印速度 1~14
125
+ * @return data
126
+ */
127
+ + (NSData *)setSpeed:(int)speed;
128
+
129
+ /**
130
+ * 打印份数
131
+ * @param count 份数
132
+ * @return data
133
+ */
134
+ + (NSData *)setPageCount:(int)count;
135
+
136
+ /**
137
+ * 设置自定义字体
138
+ * @param fontName 字体名称
139
+ * @param extension 扩展名
140
+ * @param alias 别名
141
+ * @param codePage ZPLCodePage
142
+ * @return data
143
+ */
144
+ + (NSData *)setCustomFont:(NSString *)fontName extension:(NSString *)extension alias:(NSString *)alias codePage:(ZPLCodePage)codePage;
145
+
146
+ /**
147
+ * 设置字符编码
148
+ * @param encoding NSStringEncoding
149
+ */
150
+ + (void)setStringEncoding:(NSStringEncoding)encoding;
151
+
152
+ /**
153
+ * 文本内容(枚举字体)
154
+ *
155
+ * @param x x-coordinate
156
+ * @param y y-coordinate
157
+ * @param fontName ZPLFont
158
+ * @param content text
159
+ * @return data
160
+ */
161
+ + (NSData *)drawTextWithx:(int)x y:(int)y fontName:(ZPLFont)fontName content:(NSString *)content;
162
+
163
+ /**
164
+ * 文本内容(枚举字体)
165
+ *
166
+ * @param x x-coordinate
167
+ * @param y y-coordinate
168
+ * @param fontName ZPLFont
169
+ * @param hRatio 整数倍数值 1,2,3...
170
+ * @param wRatio 整数倍数值 1,2,3...
171
+ * @param content text
172
+ * @return data
173
+ */
174
+ + (NSData *)drawTextWithx:(int)x y:(int)y fontName:(ZPLFont)fontName hRatio:(int)hRatio wRatio:(int)wRatio content:(NSString *)content;
175
+
176
+ /**
177
+ * 文本内容(枚举字体)
178
+ *
179
+ * @param x x-coordinate
180
+ * @param y y-coordinate
181
+ * @param fontName ZPLFont
182
+ * @param rotation ZPLRotation
183
+ * @param hRatio 整数倍数值 1,2,3...
184
+ * @param wRatio 整数倍数值 1,2,3...
185
+ * @param content text
186
+ * @return data
187
+ */
188
+ + (NSData *)drawTextWithx:(int)x y:(int)y fontName:(ZPLFont)fontName rotation:(ZPLRotation)rotation hRatio:(int)hRatio wRatio:(int)wRatio content:(NSString *)content;
189
+
190
+ /**
191
+ * 文本内容(自定义字体)
192
+ *
193
+ * @param x x-coordinate
194
+ * @param y y-coordinate
195
+ * @param customFontName 自定义字体
196
+ * @param hSize 基础尺寸的整数倍
197
+ * @param wSize 基础尺寸的整数倍
198
+ * @param content text
199
+ * @return data
200
+ */
201
+ + (NSData *)drawTextWithx:(int)x y:(int)y customFontName:(NSString *)customFontName hSize:(int)hSize wSize:(int)wSize content:(NSString *)content;
202
+
203
+ /**
204
+ * 文本内容(自定义字体)
205
+ *
206
+ * @param x x-coordinate
207
+ * @param y y-coordinate
208
+ * @param customFontName 自定义字体
209
+ * @param rotation ZPLRotation
210
+ * @param hSize 基础尺寸的整数倍
211
+ * @param wSize 基础尺寸的整数倍
212
+ * @param content text
213
+ * @return data
214
+ */
215
+ + (NSData *)drawTextWithx:(int)x y:(int)y customFontName:(NSString *)customFontName rotation:(ZPLRotation)rotation hSize:(int)hSize wSize:(int)wSize content:(NSString *)content;
216
+
217
+ /**
218
+ * 文本内容(不定义字体,默认FNT_26_13)
219
+ *
220
+ * @param x x-coordinate
221
+ * @param y y-coordinate
222
+ * @param content text
223
+ * @return data
224
+ */
225
+ + (NSData *)drawTextWithx:(int)x y:(int)y content:(NSString *)content;
226
+
227
+ /**
228
+ * 绘制一维码
229
+ *
230
+ * @param x x-coordinate
231
+ * @param y y-coordinate
232
+ * @param codeType ZPLBarCode
233
+ * @param text 码文内容
234
+ * @return data
235
+ */
236
+ + (NSData *)drawBarcodeWithx:(int)x y:(int)y codeType:(ZPLBarCode)codeType text:(NSString *)text;
237
+
238
+ /**
239
+ * 绘制一维码
240
+ *
241
+ * @param x x-coordinate
242
+ * @param y y-coordinate
243
+ * @param codeType ZPLBarCode
244
+ * @param height 条码高度
245
+ * @param text 码文内容
246
+ * @return data
247
+ */
248
+ + (NSData *)drawBarcodeWithx:(int)x y:(int)y codeType:(ZPLBarCode)codeType height:(int)height text:(NSString *)text;
249
+
250
+ /**
251
+ * 绘制一维码
252
+ *
253
+ * @param x x-coordinate
254
+ * @param y y-coordinate
255
+ * @param orientation N:正常 R:旋转90度(顺时针)I:反转180度 B:旋转90度(逆时针)
256
+ * @param width 模块宽度 (以点为单位) 1~10 开机时的初始值:2
257
+ * @param height 条码高度
258
+ * @param hriText ZPLHriText
259
+ * @param text 码文内容
260
+ * @return data
261
+ */
262
+ + (NSData *)drawBarcodeWithx:(int)x y:(int)y orientation:(ZPLRotation)orientation codeType:(ZPLBarCode)codeType width:(int)width height:(int)height hriText:(ZPLHriText)hriText text:(NSString *)text;
263
+
264
+ /**
265
+ * 绘制二维码
266
+ *
267
+ * @param x x-coordinate
268
+ * @param y y-coordinate
269
+ * @param factor 放大系数:1~10 默认值:在150dpi打印机上为1, 在200dpi打印机上为2, 在300dpi打印机上为3, 在600dpi打印机上为6
270
+ * @param text 二维码内容
271
+ * @return data
272
+ */
273
+ + (NSData *)drawQRCodeWithx:(int)x y:(int)y factor:(int)factor text:(NSString *)text;
274
+
275
+ /**
276
+ * 绘制图片
277
+ * @param x x-coordinate
278
+ * @param y y-coordinate
279
+ * @param image image
280
+ * @return data
281
+ */
282
+ + (NSData *)drawImageWithx:(int)x y:(int)y image:(UIImage *)image;
283
+
284
+ /**
285
+ * 绘制图片
286
+ * @param x x-coordinate
287
+ * @param y y-coordinate
288
+ * @param wRatio 1~10
289
+ * @param hRatio 1~10
290
+ * @param image image
291
+ * @return data
292
+ */
293
+ + (NSData *)drawImageWithx:(int)x y:(int)y wRatio:(int)wRatio hRatio:(int)hRatio image:(UIImage *)image;
294
+
295
+ /**
296
+ * 标签反色打印
297
+ * @param x x-coordinate
298
+ * @param y y-coordinate
299
+ * @param width 宽度
300
+ * @param height 高度
301
+ * @param radius 圆角程度 0~8 default:0
302
+ * @return data
303
+ */
304
+ + (NSData *)drawReverseColorWithx:(int)x y:(int)y width:(int)width height:(int)height radius:(int)radius;
305
+
306
+ /**
307
+ * 绘制矩形
308
+ * @param x x-coordinate
309
+ * @param y y-coordinate
310
+ * @param width 矩形宽度
311
+ * @param height 矩形高度
312
+ * @param thickness 线条宽度
313
+ * @return data
314
+ */
315
+ + (NSData *)drawBoxWithx:(int)x y:(int)y width:(int)width height:(int)height thickness:(int)thickness;
316
+
317
+ /**
318
+ * 绘制矩形
319
+ * @param x x-coordinate
320
+ * @param y y-coordinate
321
+ * @param width 矩形宽度
322
+ * @param height 矩形高度
323
+ * @param thickness 线条宽度
324
+ * @param radius 圆角程度 0~8 default:0
325
+ * @return data
326
+ */
327
+ + (NSData *)drawBoxWithx:(int)x y:(int)y width:(int)width height:(int)height thickness:(int)thickness radius:(int)radius;
328
+
329
+ /**
330
+ * 打印方向
331
+ * @param n 反转标签 YES=正常 NO=反转 默认值:YES
332
+ * @return data
333
+ */
334
+ + (NSData *)direction:(BOOL) n;
335
+
336
+ /**
337
+ * 调用图形
338
+ * @param x x-coordinate
339
+ * @param y y-coordinate
340
+ * @param source 已存储图像的源设备。接受的值:R、E、B和A,默认值:R 搜索优先级 (R、 E、 B和 A)
341
+ * @param name 已存储图像的名称。接受的值:1 至 8 个字母数字字符。如果未指定名称,则使用 UNKNOWN
342
+ * @param xMagnification x 轴的放大系数。接受的值:1 至 10,默认值:1
343
+ * @param yMagnification y 轴的放大系数。接受的值:1 至 10,默认值:1
344
+ * @return data
345
+ */
346
+ + (NSData *)printGraphic:(int)x
347
+ y:(int)y
348
+ source:(NSString *)source
349
+ name:(NSString *)name
350
+ xMagnification:(int)xMagnification
351
+ yMagnification:(int)yMagnification;
352
+
353
+ /**
354
+ * 下载图形
355
+ * @param source 存储图像的源设备。接受的值:R、E、B和A,默认值:R 搜索优先级 (R、 E、 B和 A)
356
+ * @param name 存储图像的名称。接受的值:1 至 8 个字母数字字符。如果未指定名称,则使用 UNKNOWN
357
+ * @param image image
358
+ * @return data
359
+ */
360
+ + (NSData *)downloadGraphic:(NSString *)source name:(NSString *)name image:(UIImage *)image;
361
+
362
+ /**
363
+ * 删除已下载的图形
364
+ * @param source 存储图像的源设备。接受的值:R、E、B和A,默认值:R 搜索优先级 (R、 E、 B和 A)
365
+ * @param name 存储图像的名称。接受的值:1 至 8 个字母数字字符。如果未指定名称,则使用 UNKNOWN
366
+ * @return data
367
+ */
368
+ + (NSData *)deleteDownloadGraphic:(NSString *)source name:(NSString *)name;
369
+
370
+ @end
371
+
372
+ NS_ASSUME_NONNULL_END
Binary file
@@ -0,0 +1,19 @@
1
+ @objcMembers
2
+ public class RCTTSPLBarRequest: NSObject {
3
+ public let x: Double
4
+ public let y: Double
5
+ public let width: Double
6
+ public let height: Double
7
+
8
+ public init(x: Double, y: Double, width: Double, height: Double) {
9
+ self.x = x
10
+ self.y = y
11
+ self.width = width
12
+ self.height = height
13
+ super.init()
14
+ }
15
+
16
+ override public var description: String {
17
+ "RCTTSPLBarRequest(x=\(String(describing: x)), y=\(String(describing: y)), width=\(String(describing: width)), height=\(String(describing: height)))"
18
+ }
19
+ }
@@ -0,0 +1,29 @@
1
+ @objcMembers
2
+ public class RCTTSPLBarcodeRequest: NSObject {
3
+ public let x: Double
4
+ public let y: Double
5
+ public let codeType: String
6
+ public let height: Double
7
+ public let readable: String
8
+ public let rotation: String
9
+ public let narrow: Double
10
+ public let wide: Double
11
+ public let content: String
12
+
13
+ public init(x: Double, y: Double, codeType: String, height: Double, readable: String, rotation: String, narrow: Double, wide: Double, content: String) {
14
+ self.x = x
15
+ self.y = y
16
+ self.codeType = codeType
17
+ self.height = height
18
+ self.readable = readable
19
+ self.rotation = rotation
20
+ self.narrow = narrow
21
+ self.wide = wide
22
+ self.content = content
23
+ super.init()
24
+ }
25
+
26
+ override public var description: String {
27
+ "RCTTSPLBarcodeRequest(x=\(String(describing: x)), y=\(String(describing: y)), codeType=\(String(describing: codeType)), height=\(String(describing: height)), readable=\(String(describing: readable)), rotation=\(String(describing: rotation)), narrow=\(String(describing: narrow)), wide=\(String(describing: wide)), content=\(String(describing: content)))"
28
+ }
29
+ }
@@ -0,0 +1,25 @@
1
+ @objcMembers
2
+ public class RCTTSPLBitmapCompressionRequest: NSObject {
3
+ public let x: Double
4
+ public let y: Double
5
+ public let mode: String
6
+ public let width: Double
7
+ public let bitmapPath: String?
8
+ public let bitmapContent: String?
9
+ public let algorithmType: String?
10
+
11
+ public init(x: Double, y: Double, mode: String, width: Double, bitmapPath: String?, bitmapContent: String?, algorithmType: String?) {
12
+ self.x = x
13
+ self.y = y
14
+ self.mode = mode
15
+ self.width = width
16
+ self.bitmapPath = bitmapPath
17
+ self.bitmapContent = bitmapContent
18
+ self.algorithmType = algorithmType
19
+ super.init()
20
+ }
21
+
22
+ override public var description: String {
23
+ "RCTTSPLBitmapCompressionRequest(x=\(String(describing: x)), y=\(String(describing: y)), mode=\(String(describing: mode)), width=\(String(describing: width)), bitmapPath=\(String(describing: bitmapPath)), bitmapContent=\(String(describing: bitmapContent)), algorithmType=\(String(describing: algorithmType)))"
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ @objcMembers
2
+ public class RCTTSPLBitmapRequest: NSObject {
3
+ public let x: Double
4
+ public let y: Double
5
+ public let mode: String
6
+ public let width: Double
7
+ public let bitmapPath: String?
8
+ public let bitmapContent: String?
9
+ public let algorithmType: String?
10
+
11
+ public init(x: Double, y: Double, mode: String, width: Double, bitmapPath: String?, bitmapContent: String?, algorithmType: String?) {
12
+ self.x = x
13
+ self.y = y
14
+ self.mode = mode
15
+ self.width = width
16
+ self.bitmapPath = bitmapPath
17
+ self.bitmapContent = bitmapContent
18
+ self.algorithmType = algorithmType
19
+ super.init()
20
+ }
21
+
22
+ override public var description: String {
23
+ "RCTTSPLBitmapRequest(x=\(String(describing: x)), y=\(String(describing: y)), mode=\(String(describing: mode)), width=\(String(describing: width)), bitmapPath=\(String(describing: bitmapPath)), bitmapContent=\(String(describing: bitmapContent)), algorithmType=\(String(describing: algorithmType)))"
24
+ }
25
+ }