diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock new file mode 100644 index 0000000..ab1089b --- /dev/null +++ b/example/ios/Podfile.lock @@ -0,0 +1,38 @@ +PODS: + - Flutter (1.0.0) + - flutter_blue (0.0.1): + - Flutter + - flutter_blue/Protos (= 0.0.1) + - flutter_blue/Protos (0.0.1): + - Flutter + - Protobuf (~> 3.11.4) + - hy_printer (0.0.1): + - Flutter + - Protobuf (3.11.4) + +DEPENDENCIES: + - Flutter (from `Flutter`) + - flutter_blue (from `.symlinks/plugins/flutter_blue/ios`) + - hy_printer (from `.symlinks/plugins/hy_printer/ios`) + +SPEC REPOS: + trunk: + - Protobuf + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + flutter_blue: + :path: ".symlinks/plugins/flutter_blue/ios" + hy_printer: + :path: ".symlinks/plugins/hy_printer/ios" + +SPEC CHECKSUMS: + Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + flutter_blue: eeb381dc4727a0954dede73515f683865494b370 + hy_printer: 93caaf83154d80a633bd57f43cdec0bb8b14b4c2 + Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7 + +PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d + +COCOAPODS: 1.11.0 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index eebb737..08c4b3f 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + E12BD4EFC4AC35E5A9E0DBE1 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1076D900E2392A1416228F2B /* libPods-Runner.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -30,9 +31,11 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 1076D900E2392A1416228F2B /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 73C8556BF52A4B2D10255EE6 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -44,6 +47,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D6DDA845CF550E6A1F37076D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + E8D43E98422642241BD1E3DF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -51,12 +56,32 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + E12BD4EFC4AC35E5A9E0DBE1 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 4A4C9B13300D5707518E7245 /* Pods */ = { + isa = PBXGroup; + children = ( + D6DDA845CF550E6A1F37076D /* Pods-Runner.debug.xcconfig */, + E8D43E98422642241BD1E3DF /* Pods-Runner.release.xcconfig */, + 73C8556BF52A4B2D10255EE6 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 867D8BAE1150CBAB8EC404CC /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1076D900E2392A1416228F2B /* libPods-Runner.a */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -74,7 +99,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, + 4A4C9B13300D5707518E7245 /* Pods */, + 867D8BAE1150CBAB8EC404CC /* Frameworks */, ); sourceTree = ""; }; @@ -117,6 +143,7 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + D5F76D05153C5E1BACA5488F /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, @@ -208,6 +235,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + D5F76D05153C5E1BACA5488F /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/ios/Classes/HyPrinterPlugin.m b/ios/Classes/HyPrinterPlugin.m index 8a9347a..fb9fef7 100644 --- a/ios/Classes/HyPrinterPlugin.m +++ b/ios/Classes/HyPrinterPlugin.m @@ -10,11 +10,12 @@ } - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { - if ([@"getPlatformVersion" isEqualToString:call.method]) { - result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]); + if ([@"connect" isEqualToString:call.method]) { + int result; } else { result(FlutterMethodNotImplemented); } } + @end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTBitmap+GrayLevel.h b/ios/frameworks/PrinterSDK.framework/Headers/PTBitmap+GrayLevel.h new file mode 100644 index 0000000..6599698 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTBitmap+GrayLevel.h @@ -0,0 +1,82 @@ +/*! + * \~chinese + * @header GrayLevel.h + * @abstract 图片的灰度处理 + * + * \~english + * @header GrayLevel.h + * @abstract Image gray manager + */ + +#import "PTBitmap.h" +#import + +@interface PTBitmap (GrayLevel) + + +/// 获取图像的灰度数据 +/// @param image 图片 ++ (NSData *)graylevel256Datas:(UIImage *)image; + +/// 获取图像的灰度数据 +/// @param image 图片 +/// @param needReverse 是否反转灰度值 0->255 254->1 ++ (NSData *)graylevel256Datas:(CGImageRef)image reverse:(BOOL)needReverse; + + +/// 从灰度图片数据获取图像 +/// @param data 灰度数据,每个字节代表每个像素的256阶灰度值 +/// @param width 图片宽度 ++ (UIImage *)imageWithGraylevel256Data:(NSData *)data width:(NSUInteger)width; + +/// 灰度数据锐化 +/// @param data 灰度数据,每个字节代表每个像素的256阶灰度值 +/// @param width 图片宽度 ++ (NSData *)sharpenGraylevel256Data:(NSData *)data width:(NSUInteger)width; + + +/// 获取经过热补偿处理的数据 +/// @param data 灰度数据,每个字节代表每个像素的256阶灰度值 +/// @param width 图片宽度 ++ (NSData *)historyCompensateGraylevel256Data:(NSData *)data width:(NSUInteger)width; + + +/// 返回黑白图像数据 +/// @param data 灰度数据,每个字节代表每个像素的256阶灰度值 +/// @param width 图片宽度 ++ (NSData *)binaryDataOneBytePerPixelGraylevel256Data:(NSData *)data width:(NSUInteger)width; + + +/// 将图片导入设备灰度空间获取的灰度数据 +/// @param image 图片 ++ (NSData *)systemGraylevel256Datas:(UIImage *)image; + +/// 将bitmap数据转成图片 +/// @param bitmap 位图数据 +/// @param height 图片高度 ++ (UIImage *)image:(NSData *)bitmap height:(size_t)height; + +/// 动态获取二值化的阈值 +/// @param data 256灰阶数据 +/// @param width 图片宽度 +/// @param height 图片高度 ++ (NSUInteger)getThresholdForBinaryByGrayData:(NSData *)data width:(NSUInteger)width height:(NSUInteger)height; + +/// 获取图像的灰度数据 +/// @param image 输入数据 ++ (NSData *)grayscaleImageForImage:(CGImageRef)image; + +@end + + +@interface PTBitmap(Printer) + ++ (NSData *)binaryDataOneBitPerPixelGraylevel256Data:(NSData *)data width:(NSUInteger)width; + ++ (NSData *)binaryDataOneBitPerPixelGraylevel256Data:(NSData *)data width:(NSUInteger)width valve:(NSUInteger)valve; + ++ (NSData *)ditheredBinaryDataOneBitPerPixelGraylevel256Data:(NSData *)data width:(NSUInteger)width; + ++ (NSData *)meiKaLePrinterData:(NSData *)graylevel256Data; + +@end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTBitmap.h b/ios/frameworks/PrinterSDK.framework/Headers/PTBitmap.h new file mode 100644 index 0000000..30a903a --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTBitmap.h @@ -0,0 +1,58 @@ +/*! + * \~chinese + * @header PTBitmap.h + * @abstract 图片处理 + * + * \~english + * @header PTBitmap.h + * @abstract Image manager + */ + +#import +#import +#import +#import "SDKDefine.h" + +/// 压缩模式 +typedef NS_ENUM(NSInteger,PTBitmapCompressMode) { + + PTBitmapCompressModeNone = 0, /*! *\~chinese 不压缩 *\~english None */ + PTBitmapCompressModeZPL2 = 16, /*! *\~chinese ZPL2压缩算法 *\~english ZPL2 compress */ + PTBitmapCompressModeTIFF = 32, /*! *\~chinese TIFF压缩算法 *\~english TIFF compress */ + PTBitmapCompressModeLZO = 48, /*! *\~chinese LZO压缩算法 *\~english LZO compress */ +}; + +/// 图片效果 +typedef NS_ENUM(NSInteger, PTBitmapMode) { + + PTBitmapModeBinary = 0, /*! *\~chinese 黑白二值图像 *\~english Binary */ + PTBitmapModeDithering = 1, /*! *\~chinese 灰阶抖动图像 *\~english Dithering */ + PTBitmapModeColumn = 2, /*! *\~chinese 无效 *\~english not supported */ +}; + +@interface PTBitmap : NSObject + +/// 生成打印机打印图片数据 +/// @param image 图片 +/// @param mode 图片效果 +/// @param compress 压缩模式 +/// @param package 数据是否分包 +/// @param inversion 数据是否需要取反 ++ (NSData *)getImageData:(CGImageRef)image mode:(PTBitmapMode)mode compress:(PTBitmapCompressMode)compress package:(BOOL)package inversion:(BOOL)inversion; + + +/// 用column算法生成的图片数据 +/// @param sourceBitmap 输入数据 ++ (NSData *)generateColumnData:(CGImageRef)sourceBitmap; + + +/// 将bitmap数据转成图片 +/// @param image 图片 +/// @param mode 生成的位图数据类型 简单的黑白二值化或者抖动处理 ++ (UIImage *)generateRenderingWithImage:(CGImageRef)image mode:(PTBitmapMode)mode; + +@end + + + + diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTCommandCPCL.h b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandCPCL.h new file mode 100644 index 0000000..e589c63 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandCPCL.h @@ -0,0 +1,2352 @@ +/*! + * \~chinese + * @header PTCommandCPCL.h + * @abstract CPCL指令 + * + * \~english + * @header PTCommandCPCL.h + * @abstract CPCL Command + */ + +#import +#import "PTBitmap.h" + +/*! + * \~chinese + * 纸张类型1 + * + * \~english + * Paper type + */ +typedef NS_ENUM(NSUInteger, PTCPCLPaperType) { + PTCPCLPaperContinuoue = 0, ///< continuous paper + PTCPCLPaperLabel = 1, ///< label paper + PTCPCLPaperBackBlackMark = 2, ///< back black mark + PTCPCLPaperFrontBlackMark = 3, ///< front black mark + PTCPCLPaperBlackMarkInch3 = 4, ///< 3 inch black mark + PTCPCLPaperBlackMarkInch2 = 5 ///< 2 inch black mark +}; + +/*! + * \~chinese + * 纸张类型2 + * + * \~english + * Paper type + */ +typedef NS_ENUM(NSUInteger, PTCPCLNewPaperType) { + PTCPCLNewPaperContinuoue = 0, ///< continuous paper + PTCPCLNewPaperLabel = 2, ///< label paper + PTCPCLNewBlackMarkInch2 = 4, ///< 2 inch black mark + PTCPCLNewBlackMarkInch3 = 5, ///< 3 inch black mark + PTCPCLNewBlackMarkInch4 = 6 ///< 4 inch black mark +}; + +/*! + * \~chinese + * 标签分辨率 + * + * \~english + * Label resolution + */ +typedef NS_ENUM(NSUInteger, PTCPCLLabelResolution) { + PTCPCLLabelResolution100 = 100, ///< 100 + PTCPCLLabelResolution200 = 200 ///< 200 +}; + +/*! + * \~chinese + * 条码类型 + * + * \~english + * Barcode style + */ +typedef NS_ENUM(NSUInteger, PTCPCLBarcodeStyle) { + PTCPCLBarcodeStyleUPCA = 0, + PTCPCLBarcodeStyleUPCE = 1, + PTCPCLBarcodeStyleEAN13 = 2, + PTCPCLBarcodeStyleEAN8 = 3, + PTCPCLBarcodeStyleCode39 = 4, + PTCPCLBarcodeStyleCode93 = 5, + PTCPCLBarcodeStyleCode128 = 6, + PTCPCLBarcodeStyleCodeBAR = 7 +}; + +/*! + * \~chinese + * 条码宽窄条比例 + * + * \~english + * The ratio of wide to narrow bars + */ +typedef NS_ENUM(NSUInteger, PTCPCLBarcodeBarRatio) { + PTCPCLBarcodeBarRatio0 = 0, + PTCPCLBarcodeBarRatio1 = 1, + PTCPCLBarcodeBarRatio2 = 2, + PTCPCLBarcodeBarRatio3 = 3, + PTCPCLBarcodeBarRatio4 = 4, + PTCPCLBarcodeBarRatio20 = 20, + PTCPCLBarcodeBarRatio21 = 21, + PTCPCLBarcodeBarRatio22 = 22, + PTCPCLBarcodeBarRatio23 = 23, + PTCPCLBarcodeBarRatio24 = 24, + PTCPCLBarcodeBarRatio25 = 25, + PTCPCLBarcodeBarRatio26 = 26, + PTCPCLBarcodeBarRatio27 = 27, + PTCPCLBarcodeBarRatio28 = 28, + PTCPCLBarcodeBarRatio29 = 29, + PTCPCLBarcodeBarRatio30 = 30 +}; + +/*! + * \~chinese + * 规范编号 + * + * \~english + * QRCode model number + */ +typedef NS_ENUM(NSUInteger, PTCPCLQRCodeModel) { + PTCPCLQRCodeModel1 = 1, + PTCPCLQRCodeModel2 = 2 ///< default +}; + +/*! + * \~chinese + * 二维码单元宽度 + * + * \~english + * Unit-width of the barcode in dots. 1-32,default: 6 + */ +typedef NS_ENUM(NSUInteger, PTCPCLQRCodeUnitWidth) { + PTCPCLQRCodeUnitWidth_1 = 1, + PTCPCLQRCodeUnitWidth_2, + PTCPCLQRCodeUnitWidth_3, + PTCPCLQRCodeUnitWidth_4, + PTCPCLQRCodeUnitWidth_5, + PTCPCLQRCodeUnitWidth_6, ///< default + PTCPCLQRCodeUnitWidth_7, + PTCPCLQRCodeUnitWidth_8, + PTCPCLQRCodeUnitWidth_9, + PTCPCLQRCodeUnitWidth_10, + PTCPCLQRCodeUnitWidth_11, + PTCPCLQRCodeUnitWidth_12, + PTCPCLQRCodeUnitWidth_13, + PTCPCLQRCodeUnitWidth_14, + PTCPCLQRCodeUnitWidth_15, + PTCPCLQRCodeUnitWidth_16, + PTCPCLQRCodeUnitWidth_17, + PTCPCLQRCodeUnitWidth_18, + PTCPCLQRCodeUnitWidth_19, + PTCPCLQRCodeUnitWidth_20, + PTCPCLQRCodeUnitWidth_21, + PTCPCLQRCodeUnitWidth_22, + PTCPCLQRCodeUnitWidth_23, + PTCPCLQRCodeUnitWidth_24, + PTCPCLQRCodeUnitWidth_25, + PTCPCLQRCodeUnitWidth_26, + PTCPCLQRCodeUnitWidth_27, + PTCPCLQRCodeUnitWidth_28, + PTCPCLQRCodeUnitWidth_29, + PTCPCLQRCodeUnitWidth_30, + PTCPCLQRCodeUnitWidth_31, + PTCPCLQRCodeUnitWidth_32 +}; + +/*! + * \~chinese + * 二维码纠错水平 + * + * \~english + * QRCode Error Correction Level + */ +typedef NS_ENUM(NSUInteger, PTCPCLQRCodeCorrectionLevel) { + PTCPCLQRCodeCorrectionLevelH = 0, ///< Ultra high reliability level + PTCPCLQRCodeCorrectionLevelQ = 1, ///< High reliability level + PTCPCLQRCodeCorrectionLevelM = 2, ///< Standard level + PTCPCLQRCodeCorrectionLevelL = 3 ///< High density level +}; + +/*! + * \~chinese + * 二维码字符类型 + * + * \~english + * QRCode Character mode symbols + */ +typedef NS_ENUM(NSUInteger, PTCPCLQRCodeDataInputMode) { + PTCPCLQRCodeDataInputModeA = 0, ///< Automatic(default) + PTCPCLQRCodeDataInputModeM = 1 ///< manual(ignore it,pls select ModeA) +}; + +/*! + * \~chinese + * 文本字体名称 + * + * \~english + * Text Font Name + */ +typedef NS_ENUM(NSUInteger, PTCPCLTextFontName) { + PTCPCLTextFont0 = 0, ///< khmer:12x24 + PTCPCLTextFont1 = 1, ///< chinese:24x24 english:9x17 + PTCPCLTextFont2 = 2, ///< chinese:24x24 english:12x24 + PTCPCLTextFont3 = 3, ///< chinese:20x20 english:10x20 + PTCPCLTextFont4 = 4, ///< chinese:32x32 english:16x32 + PTCPCLTextFont5 = 5, ///< chinese:24x24 english:12x24 + PTCPCLTextFont7 = 7, ///< chinese:24x24 english:12x24 + PTCPCLTextFont8 = 8, ///< chinese:24x24 english:12x24 + PTCPCLTextFont20 = 20, ///< chinese:16x16 english:8x16 + PTCPCLTextFont28 = 28, ///< chinese:28x28 english:14x28 + PTCPCLTextFont55 = 55 ///< chinese:16x16 english:8x16 +}; + +/*! + * \~chinese + * 字体放大倍数 + * + * \~english + * Font scale + */ +typedef NS_ENUM(NSUInteger, PTCPCLTextFontSize) { + PTCPCLTextFontSize0 = 0, ///< scale-> width:1 height:1, default + PTCPCLTextFontSize1 = 1, ///< scale-> width:1 height:2 + PTCPCLTextFontSize2 = 2, ///< scale-> width:2 height:1 + PTCPCLTextFontSize3 = 3, ///< scale-> width:2 height:2 + PTCPCLTextFontSize4 = 4, ///< scale-> width:2 height:3 + PTCPCLTextFontSize5 = 5, ///< scale-> width:3 height:2 + PTCPCLTextFontSize6 = 6, ///< scale-> width:3 height:3 + PTCPCLTextFontSize7 = 7, ///< scale-> width:3 height:4 +}; + +/// Scaled Font Name +typedef NS_ENUM(NSUInteger, PTCPCLScaledFontName) { + PTCPCLScaledFontNameTTF = 0, ///< default + PTCPCLScaledFontNameCSF = 1, + PTCPCLScaledFontNameFNT = 2 +}; + +/// Font Group number +typedef NS_ENUM(NSUInteger, PTCPCLFontGroupNumber) { + PTCPCLFontGroupNumber0 = 0, + PTCPCLFontGroupNumber1 = 1, + PTCPCLFontGroupNumber2 = 2, + PTCPCLFontGroupNumber3 = 3, + PTCPCLFontGroupNumber4 = 4, + PTCPCLFontGroupNumber5 = 5, + PTCPCLFontGroupNumber6 = 6, + PTCPCLFontGroupNumber7 = 7, + PTCPCLFontGroupNumber8 = 8, + PTCPCLFontGroupNumber9 = 9, + PTCPCLFontGroupNumber10 = 10 +}; + +/*! + * \~chinese + * 字体加粗 + * + * \~english + * Text bold + */ +typedef NS_ENUM(NSUInteger, PTCPCLTextBold) { + PTCPCLTextBold0 = 0, ///< default,not bold + PTCPCLTextBold1 = 1, + PTCPCLTextBold2 = 2, + PTCPCLTextBold3 = 3, + PTCPCLTextBold4 = 4, + PTCPCLTextBold5 = 5 +}; + +/*! + * \~chinese + * 旋转角度 + * + * \~english + * Rotation:Counterclockwise rotation + */ +typedef NS_ENUM(NSUInteger, PTCPCLStyleRotation) { + PTCPCLStyleRotation0 = 0, ///< Counterclockwise rotation,default + PTCPCLStyleRotation90 = 90, ///< Counterclockwise rotation 90 + PTCPCLStyleRotation180 = 180, ///< Counterclockwise rotation 180 + PTCPCLStyleRotation270 = 270 ///< Counterclockwise rotation 270 +}; + +/*! + * \~chinese + * 字体放大系数 + * + * \~english + * Font scale + */ +typedef NS_ENUM(NSUInteger, PTCPCLFontScale) { + PTCPCLFontScale_1 = 1, + PTCPCLFontScale_2, + PTCPCLFontScale_3, + PTCPCLFontScale_4, + PTCPCLFontScale_5, + PTCPCLFontScale_6, + PTCPCLFontScale_7, + PTCPCLFontScale_8, + PTCPCLFontScale_9, + PTCPCLFontScale_10, + PTCPCLFontScale_11, + PTCPCLFontScale_12, + PTCPCLFontScale_13, + PTCPCLFontScale_14, + PTCPCLFontScale_15, + PTCPCLFontScale_16 +}; + +/// auto feed ling Font +typedef NS_ENUM(NSUInteger, PTCPCLTextLineFontStyle) { + PTCPCLTextLineFontStyle0 = 0, ///< big font + PTCPCLTextLineFontStyle1 = 1 ///< small font +}; + +/*! + * \~chinese + * PDF417码的纠错等级 + * + * \~english + * The error recovery level. + */ +typedef NS_ENUM(NSUInteger, PTCPCLPDF417ErrLevel) { + PTCPCLPDF417ErrLevel_0 = 0, + PTCPCLPDF417ErrLevel_1 = 1, //default + PTCPCLPDF417ErrLevel_2, + PTCPCLPDF417ErrLevel_3, + PTCPCLPDF417ErrLevel_4, + PTCPCLPDF417ErrLevel_5, + PTCPCLPDF417ErrLevel_6, + PTCPCLPDF417ErrLevel_7, + PTCPCLPDF417ErrLevel_8 +}; + +/*! + * \~chinese + * PDF417码是水平还是垂直 + * + * \~english + * The PDF417 code horizontal or vertical. + */ +typedef NS_ENUM(NSUInteger, PTCPCLPDF417Direction) { + PTCPCLPDF417DirectionH = 0, ///< horizontal + PTCPCLPDF417DirectionV = 1 ///< vertical +}; + +/*! + * \~chinese + * PDF417数据压缩是自动还是二进制 + * + * \~english + * The compaction of data in the barcode is automatic, or explicitly set to binary. + */ +typedef NS_ENUM(NSUInteger, PTCPCLPDF417Binary) { + PTCPCLPDF417BinaryA = 0, ///< automatic + PTCPCLPDF417BinaryF = 1 ///< forced +}; + + +@interface PTCommandCPCL : NSObject + +/*! + * \~chinese + * + * 下发给打印机的数据. + * + * \~english + * + * Data sent to the printer. + * + */ +@property (nonatomic, strong) NSMutableData * _Nonnull cmdData; + +/*! + * \~chinese + * + * 是否在中通快递上调用,默认是NO,该参数只针对中通快递的固件 + * + * \~english + * + * Whether ZTO invoke,default is NO,This parameter only applies to the firmware of ZTO + * + */ +@property (nonatomic, assign) BOOL isZTO; + +/*! + * \~chinese + * + * 指令使用的编码,默认是GBK. + * + * \~english + * + * encode,default is GBK. + * + */ +@property (nonatomic, assign) NSStringEncoding encoding; + +/*! + * \~chinese + * + * 添加指令. + * + * @brief 添加指令. + * @param cmd 指令文本.使用encoding属性进行编码. + * + * \~english + * + * append command. + * + * @brief append command. + * @param cmd command text. encode with encoding property. + * + */ +- (void)appendCommand:(NSString * _Nonnull)cmd; + +/*! + * \~chinese + * + * 添加指令. + * + * @brief 添加指令. + * @param cmd 指令数据. + * + * \~english + * + * append command. + * + * @brief append command. + * @param cmd command data. + * + */ +- (void)appendCommandData:(NSData * _Nonnull)data; + +/*! + * \~chinese + * + * 打印自检页. + * + * @brief 打印自检页. + * + * \~english + * + * selfTest. + * + * @brief selfTest. + * + */ +- (void)printSelfInspectionPage; + +/*! + * \~chinese + * + * 获取打印机状态,对receiveDataBlock的回调的16进制数据进行解析. + * + * @brief 获取打印机状态 + * + | 位(返回值) | 1 | 0 | + | --------- | ----------- |-----------| + | 0 | 忙碌 | 准备就绪 | + | 1 | 缺纸 | 纸充足 | + | 2 | 开盖 | 合盖 | + | 3 | 低电量 | 电量正常 | + + * + * \~english + * + * Get print status,ReceiveDataBlock callback hexadecimal data parsing. + * + * @brief Get Print Status + * + | Bit(return value) | 1 | 0 | + | ----------------- | ------------------- |--------------------- | + | 0 | Printer is Busy | Printer is Ready | + | 1 | Paper is Out | Paper is OK | + | 2 | Head Latch is Open | Head Latch is Closed | + | 3 | Battery is Low | Battery is OK | + * + */ +- (void)cpclGetPaperStatus; + +/*! + * \~chinese + * + * 获取固件版本号 + * + * @brief 获取固件版本号 + * + * \~english + * + * firmware version. + * + * @brief firmware version. + * + */ +- (void)getFirmwareVersion; + +/*! + * \~chinese + * + * 开关打印状态回调,可通过调用printStateBlock接口后得到打印机完成的状态. + * + * @brief 开关打印状态回调. + * + * \~english + * + * Turn on/off print status callback,the state of printer completion can be obtained by calling the printStateBlock interface. + * + * @brief Turn on/off print status callback. + * + */ +- (void)cpclTurnOnPrintStatusCallBack:(BOOL)flag; + +/*! + * \~chinese + * + * 打开下划线. + * + * @brief 打开下划线. + * + * \~english + * + * Turn on underline. + * + * @brief Turn on underline. + * + */ +- (void)cpclUnderlineON; + +/*! + * \~chinese + * + * 关闭下划线. + * + * @brief 关闭下划线. + * + * \~english + * + * Turn off underline. + * + * @brief Turn off underline. + * + */ +- (void)cpclUnderlineOFF; + +/*! + * \~chinese + * + * 开始标签会话. + * + * @brief 开始标签会话. + * @param offset 标签的横向偏移量. + * @param hRes 标签横向分辨率(点/英寸). 100 或 200 + * @param vRes 标签纵向分辨率(点/英寸). 100 或 200 + * @param height 标签点高. 0-65535 + * @param quantity 标签打印份数. 0-1024 + * + * \~english + * + * start label session. + * + * @brief start label session. + * @param offset The number of units to offset all fields from the left side of the label horizontally. 0-65535 + * @param hRes The horizontal resolution of this label, expressed in dots per inch. 100 or 200 + * @param vRes The vertical resolution of this label, expressed in dots per inch. 100 or 200 + * @param height The height of the label in units. 0-65535 + * @param quantity The number of copies of the label to print. 0-1024 + * + */ +- (void)cpclLabelWithOffset:(NSInteger)offset + hRes:(PTCPCLLabelResolution)hRes + vRes:(PTCPCLLabelResolution)vRes + height:(NSInteger)height + quantity:(NSInteger)quantity; + +/*! + * \~chinese + * + * 指定标签宽度,设置需要打印的宽度. + * + * @brief 指定标签宽度. + * @param pageWidth 标签宽度(点) + * + * \~english + * + * used to specify the width a label session,Set the width you want to print. + * + * @brief used to specify the width a label session. + * @param pageWidth width of a label session in dots. + * + */ +- (void)cpclPageWidth:(NSInteger)pageWidth; + +/*! + * \~chinese + * + * 横向条码打印. + * + * @brief 横向条码打印. + * @param type 条码类型. UPCA/UPCE/EAN13/EAN8/39/93/128/CODABAR + * @param width 窄条宽度. + * @param ratio 宽窄条比例. 0-4,20-30 + * @param height 条码高度. + * @param x 横向起始位置. + * @param y 纵向起始位置. + * @param barcode 条码内容. + * + * \~english + * + * horizonal barcode. + * + * @brief horizonal barcode. + * @param type The type of barcode to print. UPCA/UPCE/EAN13/EAN8/39/93/128/CODABAR + * @param width The width of a narrow bar. + * @param ratio The ratio of wide to narrow bars. 0-4,20-30 + * @param height The height of the barcode. + * @param x The X position where the barcode begins + * @param y The Y position where the barcode begins + * @param barcode The data to be encoded into a barcode + * + */ +- (void)cpclBarcode:(PTCPCLBarcodeStyle)type + width:(NSInteger)width + ratio:(PTCPCLBarcodeBarRatio)ratio + height:(NSInteger)height + x:(NSInteger)x + y:(NSInteger)y + barcode:(NSString * _Nonnull)barcode; + +/*! + * \~chinese + * + * 纵向条码打印. + * + * @brief 纵向条码打印. + * @param type 条码类型. + * @param width 窄条宽度. + * @param ratio 宽窄条比例. 0-4,20-30 + * @param height 条码高度. + * @param x 横向起始位置. + * @param y 纵向起始位置. + * @param barcode 条码内容. + * + * \~english + * + * vertical barcode. + * + * @brief vertical barcode. + * @param type The type of barcode to print. + * @param width The width of a narrow bar. + * @param ratio The ratio of wide to narrow bars. 0-4,20-30 + * @param height The height of the barcode. + * @param x The X position where the barcode begins + * @param y The Y position where the barcode begins + * @param barcode The data to be encoded into a barcode + * + */ +- (void)cpclBarcodeVertical:(PTCPCLBarcodeStyle)type + width:(NSInteger)width + ratio:(PTCPCLBarcodeBarRatio)ratio + height:(NSInteger)height + x:(NSInteger)x + y:(NSInteger)y + barcode:(NSString * _Nonnull)barcode; + +/*! + * \~chinese + * + * 指定条码下方文字格式. + * + * @brief 指定条码下方文字格式. + * @param font 字体名. + * @param fontSize 字体大小, 0-999. + * @param offset 文本距离条码的偏移量,0-999. + * + * \~english + * + * used to specify if a human-readable text representation of barcode data should be printed below 1D barcodes. + * + * @brief Specify the barcode below the text format + * @param font A font name or number to create the representation + * @param fontSize The size of the font: 0-999 + * @param offset How far in units the text is from the barcode:0-999 + * + */ +- (void)cpclBarcodeTextWithFont:(PTCPCLTextFontName)font + fontSize:(NSInteger)fontSize + offset:(NSInteger)offset; + +/*! + * \~chinese + * + * 指定条码下方文字格式. + * + * @brief 指定条码下方文字格式. + * @param font 字体文件名. + * @param xScale 字符横向大小(点). + * @param yScale 字符纵向大小(点). + * @param offset 文本距离条码的偏移量,0-999. + * + * \~english + * + * used to specify if a human-readable text representation of barcode data should be printed below 1D barcodes. + * + * @brief Specify the barcode below the text format + * @param font The filename of the TTF font with extension. + * @param xScale The X size of the font, in dots: 0-999. + * @param yScale The Y size of the font, in dots: 0-999. + * @param offset How far in units the text is from the barcode:0-999. + * + */ +- (void)cpclBarcodeTextWithTrueTypeFont:(PTCPCLTextFontName)font + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + offset:(NSInteger)offset; + +/*! + * \~chinese + * + * 结束条码底部文字展示. + * + * @brief 结束条码底部文字展示. + * + * \~english + * + * turn off the addition of the text representation. + * + * @brief turn off the addition of the text representation. + */ +- (void)cpclBarcodeTextOff; + +/*! + * \~chinese + * + * 横向QR码打印 + * + * @brief 横向QR码打印 + * @param xPos 横向开始点. + * @param yPos 纵向开始点. + * @param model 规范编号, 1 或 2. + * @param unitWidth 单元宽度. 范围是1-32,默认是6 + * + * \~english + * + * horizonal QR barcode. + * + * @brief horizonal QR barcode. + * @param xPos The X position where the barcode begins + * @param yPos The Y position where the barcode begins + * @param model Specifies the model of QR code to print.1 or 2 + * @param unitWidth Unit-width of the barcode in dots. 1-32,default: 6. + * + */ +- (void)cpclBarcodeQRcodeWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + model:(PTCPCLQRCodeModel)model + unitWidth:(PTCPCLQRCodeUnitWidth)unitWidth; + +/*! + * \~chinese + * + * 纵向QR码打印 + * + * @brief 纵向QR码打印 + * @param xPos 横向开始点. + * @param yPos 纵向开始点. + * @param model 规范编号, 1 或 2. + * @param unitWidth 单元宽度. 范围是1-32,默认是6 + * + * \~english + * + * vertical QR barcode. + * + * @brief vertical QR barcode. + * @param xPos The X position where the barcode begins + * @param yPos The Y position where the barcode begins + * @param model Specifies the model of QR code to print.1 or 2 + * @param unitWidth Unit-width of the barcode in dots. 1-32,default: 6. + * + */ +- (void)cpclBarcodeVerticalQRcodeWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + model:(PTCPCLQRCodeModel)model + unitWidth:(PTCPCLQRCodeUnitWidth)unitWidth; + +/*! + * \~chinese + * + * 添加QR码数据. + * + * @brief 添加QR码数据. + * @param level 纠错级别 + * @param characterMode 输入的字符模式符号 + * @param context 数据 + * + * \~english + * + * QR Data. + * + * @brief QR Data. + * @param level Error Correction + * @param characterMode Data Input Mode + * @param context Data for barcode + * + */ +- (void)cpclBarcodeQRCodeCorrectionLecel:(PTCPCLQRCodeCorrectionLevel)level characterMode:(PTCPCLQRCodeDataInputMode)characterMode context:(NSString *_Nonnull)context; + +/*! + * \~chinese + * + * QR码结束. + * + * @brief QR码结束. + * + * \~english + * + * The QR code terminator. + * + * @brief The QR code terminator. + * + */ +- (void)cpclBarcodeQRcodeEnd; + + +/*! + * \~chinese + * + * 配置PDF417码的参数 + * + * @brief 配置PDF417码的参数 + * @param directon 水平还是垂直 + * @param xPos 条形码开始的X位置 (0 to 65535 units) + * @param yPos 条形码开始的Y位置 (0 to 65535 units) + * @param xDot 单个元素的X大小(以点为单位),默认是2 (0 to 65535) + * @param yDot 单个元素的Y大小(以点为单位),默认是6 (0 to 65535) + * @param columns 指定要使用的列数 (1 to 30),默认是3 + * @param rows 指定要使用的行数 (0 to 90),默认是0 + * @param ecc 指定错误恢复级别 (0 to 8),默认是1 + * @param binaryModel 强制二进制压缩模式 (0 or 1),默认是0 + * + * \~english + * + * Config PDF417 parameters + * + * @brief Config PDF417 parameters + * @param directon horizontal or vertical + * @param xPos The X position where the barcode begins (0 to 65535 units) + * @param yPos The Y position where the barcode begins (0 to 65535 units) + * @param xDot The X size of a single element in dots,the default value is 2 (0 to 65535) + * @param yDot The Y size of a single element in dots,the default value is 6(0 to 65535) + * @param columns Specifies the number of columns to use,the default value is 3 (1 to 30) + * @param rows Specifies the number of rows to use,the default value is 0 (0 to 90) + * @param ecc Specifies the error recovery level,the default value is 1 (0 to 8) + * @param binaryModel Force binary compaction mode,the default value is 0 (0 or 1) + */ +- (void)cpclPDF417CodeWithDirection:(PTCPCLPDF417Direction)directon + xPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xDot:(NSInteger)xDot + yDot:(NSInteger)yDot + columns:(NSInteger)columns + rows:(NSInteger)rows + ecc:(PTCPCLPDF417ErrLevel)ecc + binaryModel:(PTCPCLPDF417Binary)binaryModel; + + +/*! + * \~chinese + * + * 添加PDF417码数据. + * + * @brief 添加PDF417码数据. + * @param context 数据 + * + * \~english + * + * PDF417 Data. + * + * @brief PDF417 Data. + * @param context data + * + */ +- (void)cpclPDF417CodeAddContext:(NSString *_Nullable)context; + +/*! + * \~chinese + * + * PDF417码结束. + * + * @brief PDF417码结束. + * + * \~english + * + * The PDF417 code terminator. + * + * @brief The PDF417 code terminator. + * + */ +- (void)cpclPDF417codeEnd; + + +/*! + * \~chinese + * + * 绘制矩形. + * + * @brief 绘制矩形. + * @param xPos 横向开始点(0~65535) + * @param yPos 纵向开始点(0~65535) + * @param xEnd 横向结束点(0~65535) + * @param yEnd 纵向结束点(0~65535) + * @param thickness 线条宽度.(0~65535) + * + * \~english + * + * draw box. + * + * @brief draw box. + * @param xPos The X origin of the box.(0~65535) + * @param yPos The Y origin of the box.(0~65535) + * @param xEnd The X coordinate where the box ends.(0~65535) + * @param yEnd The Y coordinate where the box ends.(0~65535) + * @param thickness The thickness of the lines in the box.(0~65535) + * + */ +- (void)cpclBoxWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd + thickness:(NSInteger)thickness; + +/*! + * \~chinese + * + * 画线条. + * + * @brief 画线条. + * @param xPos 起点的x坐标 + * @param yPos 起点的y坐标 + * @param xEnd 终点的x坐标 + * @param yEnd 终点的y坐标 + * @param thickness 线条的单位宽度 + * + * \~english + * + * draw line. + * + * @brief draw line. + * @param xPos The X origin of the line. + * @param yPos The Y origin of the line. + * @param xEnd The X coordinate where the line ends. + * @param yEnd The Y coordinate where the line ends. + * @param thickness The thickness of the line. + * + */ +- (void)cpclLineWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd + thickness:(NSInteger)thickness; + +/*! + * \~chinese + * + * 反白线条. + * + * @brief 反白线条. + * @param xPos 横向开始点(0~65535) + * @param yPos 纵向开始点(0~65535) + * @param xEnd 横向结束点(0~65535) + * @param yEnd 纵向结束点(0~65535) + * @param thickness 线条宽度.(0~65535) + * + * \~english + * + * draw inverse line. + * + * @brief draw inverse line. + * @param xPos The X origin of the box.(0~65535) + * @param yPos The Y origin of the box.(0~65535) + * @param xEnd The X coordinate where the box ends.(0~65535) + * @param yEnd The Y coordinate where the box ends.(0~65535) + * @param thickness The thickness of the lines in the box.(0~65535) + * + */ +- (void)cpclInverseLineWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd + thickness:(NSInteger)thickness; + +/*! + * \~chinese + * + * 打印图片 + * + * @brief 打印图片 + * @param Xpos 横向开始打印位置 + * @param Ypos 纵向开始打印位置 + * @param image 需要打印的图片 + * @param bitmapMode 位图的类型,黑白和灰阶抖动 + * @param compress 打印机支持的压缩类型 + * @param isPackage 是否需要分包 + * + * \~english + * + * Print Image + * + * @brief Print Image + * @param Xpos Horizontal starting position. + * @param Ypos Vertical starting position. + * @param image Print image + * @param bitmapMode Bitmap type + * @param compress The type of compression supported by the printer + * @param isPackage Whether the pictures need to be subcontracted + * + */ +- (void)cpclPrintBitmapWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + image:(CGImageRef _Nullable )image + bitmapMode:(PTBitmapMode)bitmapMode + compress:(PTBitmapCompressMode)compress + isPackage:(BOOL)isPackage; + + +/*! + * \~chinese + * + * 开始横向文本串联. + * + * @brief 开始横向文本串联. + * @param xPos 横向起始位置 + * @param yPos 纵向起始位置 + * + * \~english + * + * concatenate multiple fonts and sizes of text on to a single line, and to align their top-lines in a specific way. + * + * @brief Horizontal text series + * @param xPos The X origin of the text string. + * @param yPos The Y origin of the text string. + * + */ +- (void)cpclConcatStartWithXPos:(NSInteger)xPos yPos:(NSInteger)yPos; + +/*! + * \~chinese + * + * 开始纵向文本串联. + * + * @brief 开始纵向文本串联. + * @param xPos 横向起始位置 + * @param yPos 纵向起始位置 + * + * \~english + * + * concatenate multiple fonts and sizes of text on to a single line, and to align their top-lines in a specific way. + * + * @brief Vertical text series. + * @param xPos The X origin of the text string. + * @param yPos The Y origin of the text string. + * + */ +- (void)cpclConcatVerticalStartWithXPos:(NSInteger)xPos yPos:(NSInteger)yPos; + +/*! + * \~chinese + * + * 拼接文本. + * + * @brief 拼接文本. + * @param font 字体名称. + * @param fontSize 字体大小. + * @param offset 文字纵向偏移(以开始文字串联Y的位置为标准). + * @param text 文字内容. + * + * \~english + * + * concat text. + * + * @brief concat text. + * @param font font. + * @param fontSize font size. + * @param offset How far from Y is the top of this text. + * @param text The text data to be concatenated. + * + */ +- (void)cpclConcatTextWithFont:(PTCPCLTextFontName)font + fontSize:(NSInteger)fontSize + offset:(NSInteger)offset + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 拼接可缩放的水平文本. + * + * @brief 拼接可缩放的水平文本. + * @param scaledFont 可缩放字体. + * @param xScale 字体横向大小(点). + * @param yScale 字体纵向大小(点) + * @param offset 文字纵向偏移(以开始文字串联Y的位置为标准). + * @param text 文字内容. + * + * \~english + * + * concat scaled text. + * + * @brief concat scaled text. + * @param scaledFont A scaled font used to create the text. + * @param xScale The X size of the scaled font, in points. + * @param yScale The Y size of the scaled font, in points. + * @param offset offset How far from Y is the top of this text. + * @param text The text data to be concatenated. + * + */ +- (void)cpclConcatScaleTextWithScaledFont:(NSInteger)scaledFont + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + offset:(NSInteger)offset + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 拼接可缩放的垂直文本. + * + * @brief 拼接可缩放的垂直文本. + * @param scaledFont 可缩放字体. + * @param xScale 字体横向大小(点). + * @param yScale 字体纵向大小(点) + * @param offset 文字纵向偏移(以开始文字串联Y的位置为标准). + * @param text 文字内容. + * + * \~english + * + * concat scaled Vertical text. + * + * @brief concat scaled Vertical text. + * @param scaledFont A scaled font used to create the text. + * @param xScale The X size of the scaled font, in points. + * @param yScale The Y size of the scaled font, in points. + * @param offset offset How far from Y is the top of this text. + * @param text The text data to be concatenated. + * + */ +- (void)cpclConcatVerticalScaleTextWithScaledFont:(NSInteger)scaledFont + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + offset:(NSInteger)offset + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 拼接字体组文本. + * + * @brief 拼接字体组文本. + * @param fontGroup 字体组编码(0-10) + * @param offset 文字纵向偏移(以开始文字串联Y的位置为标准). + * @param text 文字内容. + * + * \~english + * + * concat font group. + * + * @brief concat font group. + * @param fontGroup Font group number.(0-10) + * @param offset offset How far from Y is the top of this text. + * @param text The text data to be concatenated. + * + */ +- (void)cpclConcatTextWithFontGroup:(PTCPCLFontGroupNumber)fontGroup + offset:(NSInteger)offset + text:(NSString * _Nonnull)text; +/*! + * \~chinese + * + * 结束文本串联. + * + * @brief 结束文本串联. + * + * \~english + * + * terminate concat command. + * + * @brief terminate concat command. + * + */ +- (void)cpclConcatEnd; + +/*! + * \~chinese + * + * 标签会话结束,打印标签. + * + * @brief 标签会话结束,打印标签. + * + * \~english + * + * terminate a CPCL label session, and create the resulting print out. + * + * @brief The tag end of the session + * + */ +- (void)cpclPrint; + +/*! + * \~chinese + * + * 反向打印,将整个标签旋转180. + * + * @brief 反向打印,将整个标签旋转180. + * + * \~english + * + * Reverse print,Rotate the label 180. + * + * @brief Reverse print,Rotate the label 180. + * + */ +- (void)cpclPoPrint; + + + +/*! + * \~chinese + * + * 居中 + * + * @brief 居中 + * @param range 居中区域宽度. + * + * \~english + * + * center justification. + * + * @brief center justification. + * @param range The width of the area to center on from the left side. + * + */ +- (void)cpclCenterWithRange:(NSInteger)range; + +/*! + * \~chinese + * + * 居中 + * + * @brief 居中 + * + * \~english + * + * center justification. + * + * @brief center justification. + * + */ +- (void)cpclCenter; + +/*! + * \~chinese + * + * 左对齐. + * + * @brief 左对齐. + * @param range 用于为FONT-GROUP指令指定文字区域 + * + * \~english + * + * left justification. + * + * @brief left justification. + * @param range When used with LEFT, the only function Range performs is a field specification function for FONT-GROUP. + * + */ +- (void)cpclLeft:(NSInteger)range; + + +/*! + * \~chinese + * + * 左对齐. + * + * @brief 左对齐. + * + * \~english + * + * left justification. + * + * @brief left justification. + * + */ +- (void)cpclLeft; + +/*! + * \~chinese + * + * 右对齐. + * + * @brief 右对齐. + * @param right 要对齐的右边界位置. + * + * \~english + * + * right justification. + * + * @brief right justification. + * @param right the location of the right side to justify to. + * + */ +- (void)cpclRight:(NSInteger)right; + +/*! + * \~chinese + * + * 右对齐. + * + * @brief 右对齐. + * + * \~english + * + * right justification. + * + * @brief right justification. + * + */ +- (void)cpclRight; + +/*! + * \~chinese + * + * 开始多行文本打印. + * + * @brief 开始多行文本打印. + * @param lineHeight 每行的高度(点). + * + * \~english + * + * print a number of lines of text using the same font without having to manually specify the spacing or positioning of each line. + * + * @brief Start multiline text printing. + * @param lineHeight Spacing between each line in units. + */ +- (void)cpclMultiLineStartWithLineHeight:(NSInteger)lineHeight; + +/*! + * \~chinese + * + * 结束多行文本打印. + * + * @brief 结束多行文本打印. + * + * \~english + * + * terminated multi line command. + * + * @brief terminated multi line command. + * + */ +- (void)cpclMultiLineEnd; + +/*! + * \~chinese + * + * 指定可放大字体或TrueType字体的旋转角度. + * + * @brief 指定可放大字体或TrueType字体的旋转角度. + * @param degrees 逆时针旋转角度. + * + * \~english + * + * specify the rotation of a scalable or TrueType font within the printer. + * + * @brief specify the rotation of a scalable or TrueType font within the printer. + * @param degrees The number of degrees to rotate counter-clockwise. + * + */ +- (void)cpclRotate:(NSInteger)degrees; + +/*! + * \~chinese + * + * 打印缩放文本或TrueType字体文字. + * + * @brief 打印缩放文本或TrueType字体文字. + * @param scaledFont 字体名. + * @param xScale 横向字体大小(点). + * @param yScale 纵向字体大小(点). + * @param x 横向起始位置. + * @param y 纵向起始位置. + * @param text 文本内容. + * + * \~english + * + * print scaled text in CPCL from either a scaled or TrueType font. + * + * @brief print scaled text in CPCL from either a scaled or TrueType font. + * @param scaledFont A scaled font used to create the text. + * @param xScale The X size of the scaled font, in points. + * @param yScale The Y size of the scaled font, in points. + * @param x The X origin of the scaled text in units. + * @param y The Y origin of the scaled text in units. + * @param text The text data to be printed. + * + */ +- (void)cpclScaleText:(PTCPCLScaledFontName)scaledFont + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 纵向打印缩放文本或TrueType字体文字. + * + * @brief 纵向打印缩放文本或TrueType字体文字. + * @param scaledFont 字体名. + * @param xScale 横向字体大小(点). + * @param yScale 纵向字体大小(点). + * @param x 横向起始位置. + * @param y 纵向起始位置. + * @param text 文本内容. + * + * \~english + * + * print scaled text in CPCL from either a scaled or TrueType font. rotated 90 degrees. + * + * @brief print scaled text in CPCL from either a scaled or TrueType font. rotated 90 degrees. + * @param scaledFont A scaled font used to create the text. + * @param xScale The X size of the scaled font, in points. + * @param yScale The Y size of the scaled font, in points. + * @param x The X origin of the scaled text in units. + * @param y The Y origin of the scaled text in units. + * @param text The text data to be printed. + * + */ +- (void)cpclScaleTextVertical:(PTCPCLScaledFontName)scaledFont + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 打印自适应大小文本.仅可放大字体或TrueType字体可用. + * + * @brief 打印自适应大小文本 + * @param scaledFont 字体名. + * @param width 横向打印区域. + * @param height 纵向打印区域. + * @param x 横向起始位置. + * @param y 纵向起始位置. + * @param text 文本内容. + * + * \~english + * + * print scaled text which is to fit within a particular bounding box. It can be used with TrueType or scaled fonts. + * + * @brief print scaled text which is to fit within a particular bounding box + * @param scaledFont A scaled font used to create the text. + * @param width The width of the box to contain the text. + * @param height The height of the box to contain the text. + * @param x The X origin of the scaled text in units. + * @param y The Y origin of the scaled text in units. + * @param text The text data to be printed. + * + */ +- (void)cpclScaleToFit:(PTCPCLScaledFontName)scaleFont + width:(NSInteger)width + height:(NSInteger)height + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 字体加粗. + * + * @brief 字体加粗. + * @param boldness 加粗程度. + * + * \~english + * + * add a faux bolding effect to pre-scaled fonts. + * + * @brief add a faux bolding effect to pre-scaled fonts. + * @param boldness the boldness of the text. + * + */ +- (void)cpclSetBold:(PTCPCLTextBold)boldness; + +/*! + * \~chinese + * + * 设置字间距. + * + * @brief 设置字间距. + * @param spacing 字间距. + * + * \~english + * + * set the horizontal spacing between characters. + * + * @brief set the horizontal spacing between characters. + * @param spacing the spacing between characters of a font. + * + */ +- (void)cpclSetSpacing:(NSInteger)spacing; + +/*! + * \~chinese + * + * 设置字体放大倍数 + * + * @brief 设置字体放大倍数 + * @param width 宽度放大系数, 1-16. + * @param height 高度放大系数, 1-16. + * + * \~english + * + * set the output scaling of pre-scaled fonts + * + * @brief set the output scaling of pre-scaled fonts + * @param width the width multiplier of the font, 1-16. + * @param height the height multiplier of the font, 1-16. + * + */ +- (void)cpclSetMagWithWidth:(PTCPCLFontScale)width height:(PTCPCLFontScale)height; + +/*! + * \~chinese + * + * 打印自动换行文本. + * + * @brief 打印自动换行文本. + * @param rotate 文字旋转方向 + * @param font 字体 + * @param fontSize 字体放大倍数,该接口默认是0,其他值无效 + * @param x 起始位置x + * @param y 起始位置y + * @param safeHeight 打印区域高度,超过高度部分不会打印 + * @param width 打印区域宽度,宽度为0表示不自动换行 + * @param lineSpacing 行间隔 + * @param fontScale 字体放大倍数 + * @param text 打印内容 + * @return 自动换行后的实际打印高度 + * + * \~english + * + * print text that feed line automatically. + * + * @brief print text that feed line automatically. + * @param rotate text rotate. + * @param font text font. + * @param fontSize text font scale,deault is 0,other values are invalid + * @param x orgin x of text. + * @param y origin y of text. + * @param safeHeight height of text field.Part will not print more than height + * @param width width of text field.if width is 0,not auto line + * @param lineSpacing line space. + * @param fontScale Font magnification factor + * @param text text. + * @return Actual print height after automatic line feed + */ +- (NSInteger)cpclAutoTextWithRotate:(PTCPCLStyleRotation)rotate + font:(PTCPCLTextFontName)font + fontSize:(NSInteger)fontSize + x:(NSInteger)x + y:(NSInteger)y + safeHeight:(NSInteger)safeHeight + width:(NSInteger)width + lineSpacing:(NSInteger)lineSpacing + fontScale:(PTCPCLFontScale)fontScale + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 打印自动换行文本,此接口解决旋转90后打印居中文本,旋转90\270后,cpclCenter接口无效 + * + * @brief 打印自动换行文本. + * @param rotate 文字旋转方向 + * @param font 字体 + * @param fontSize 字体放大倍数,该接口默认是0,其他值无效 + * @param xPos 起始位置x + * @param yPos 起始位置y + * @param center 是否居中 + * @param safeHeight 打印区域高度,超过高度部分不会打印 + * @param width 打印区域宽度,宽度为0表示不自动换行 + * @param lineSpacing 行间隔 + * @param fontScale 字体放大倍数 + * @param text 打印内容 + * @return 自动换行后的实际打印高度 + * + * \~english + * + * print text that feed line automatically.rotate 90\270,the cpclCenter interface is invalid + * + * @brief print text that feed line automatically + * @param rotate text rotate. + * @param font text font. + * @param fontSize text font scale,deault is 0,other values are invalid + * @param xPos orgin x of text. + * @param yPos origin y of text. + * @param center Whether in the middle + * @param safeHeight height of text field.Part will not print more than height + * @param width width of text field.if width is 0,not auto line + * @param lineSpacing line space. + * @param fontScale Font magnification factor. + * @param text text. + * @return Actual print height after automatic line feed + */ +- (NSInteger)cpclAutoTextWithRotate:(PTCPCLStyleRotation)rotate + font:(PTCPCLTextFontName)font + fontSize:(NSInteger)fontSize + xPos:(NSInteger)xPos + yPos:(NSInteger)yPos + center:(BOOL)center + safeHeight:(NSInteger)safeHeight + width:(NSInteger)width + lineSpacing:(NSInteger)lineSpacing + fontScale:(PTCPCLFontScale)fontScale + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 文本自动换行,建议使用 + * + * @brief 自动换行 + * @param font 字体,中文:PTCPCLThaiFontStyle1,其他:PTCPCLThaiFontStyle0 + * @param fontSize 字体大小,默认0 + * @param x 起始位置x + * @param y 起始位置y + * @param lineSpace 行间隔,默认值30 + * @param width 打印区域宽度,默认0,若x+width大于页面宽度的话,width=w-x + * @param text 打印内容 + * + * \~english + * + * Text wrap automatically, recommended + * + * @brief Text wraps automatically + * @param font text font,chinese:PTCPCLThaiFontStyle1,other:PTCPCLThaiFontStyle0 + * @param fontSize text font size.deault 0 + * @param x orgin x of text. + * @param y origin y of text. + * @param lineSpace Line spacing for automatic line feed.default 30 + * @param width width of text field. + * @param text text. + */ +- (void)cpclPrintAutoTextWithFont:(PTCPCLTextLineFontStyle)font + fontSize:(NSInteger)fontSize + x:(NSInteger)x + y:(NSInteger)y + lineSpace:(NSInteger)lineSpace + width:(NSInteger)width + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 打印居中文本 + * + * @brief 打印居中文本 + * @param rotate 文字旋转方向 + * @param font 字体 + * @param fontSize 该参数无效,传0即可 + * @param x 起始位置x + * @param y 起始位置y + * @param width 打印区域宽度 + * @param text 打印内容 + * + * \~english + * + * Print center text + * + * @brief Print center text + * @param rotate text rotate. + * @param font text font. + * @param fontSize This parameter is invalid, default is 0 + * @param x orgin x of text. + * @param y origin y of text. + * @param width width of textbox + * @param text content of text. + */ +- (void)cpclCenterTextWithRotate:(PTCPCLStyleRotation)rotate + font:(PTCPCLTextFontName)font + fontSize:(NSInteger)fontSize + x:(NSInteger)x + y:(NSInteger)y + width:(NSInteger)width + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 打印文本. + * + * @brief 打印文本. + * @param rotate 文字旋转方向 + * @param font 字体类型 + * @param fontSize 字体放大倍数,该参数默认是0,如果选择其他的枚举值,需要打印机固件支持;固件不支持的情况下,放大字体可使用(cpclSetMagWithWidth: height:)接口 + * @param x 起始位置x + * @param y 起始位置y + * @param text 打印内容 + * + * \~english + * + * print text. + * + * @brief print text. + * @param rotate text rotate. + * @param font text font. + * @param fontSize text font scale,This parameter is 0 by default. If other enumeration values are selected, printer firmware support is required. In cases where the firmware is not supported, the zoom font can be used (cpclSetMagWithWidth: height:) interface + * @param x orgin x of text. + * @param y origin y of text. + * @param text text. + */ +- (void)cpclTextWithRotate:(PTCPCLStyleRotation)rotate + font:(PTCPCLTextFontName)font + fontSize:(PTCPCLTextFontSize)fontSize + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +/*! + * \~chinese + * + * 打印反白加粗文本. + * + * @brief 打印反白加粗文本. + * @param font 字体 + * @param rotate 文字旋转方向 + * @param fontSize 字体放大倍数,该参数默认是0,如果选择其他的枚举值,需要打印机固件支持;固件不支持的情况下,放大字体可使用(cpclSetMagWithWidth: height:)接口 + * @param reverse 是否反白 + * @param bold 加粗 + * @param x 起始位置x + * @param y 起始位置y + * @param text 打印内容 + * + * \~english + * + * print reverse bold text. + * + * @brief print reverse bold text. + * @param font text font. + * @param rotate text rotate. + * @param fontSize text font scale,This parameter is 0 by default. If other enumeration values are selected, printer firmware support is required. In cases where the firmware is not supported, the zoom font can be used (cpclSetMagWithWidth: height:) interface + * @param reverse Whether it is reversed + * @param bold bold + * @param x origin x of text. + * @param y origin y of text. + * @param text text. + */ +- (void)appendTextWithFont:(PTCPCLTextFontName)font + rotate:(PTCPCLStyleRotation)rotate + fontSize:(PTCPCLTextFontSize)fontSize + reverse:(BOOL)reverse + bold:(PTCPCLTextBold)bold + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +///////////////////////////////////////////////////////////////////// +/***************** Background Text Commands *******************/ +///////////////////////////////////////////////////////////////////// + +/*! + * \~chinese + * + * 设置背景黑度值.(0-255) 0:normal,部分机型不支持 + * + * @brief 设置背景黑度值 + * @param value 黑度值. + * + * \~english + * + * Set the background blackness value.(0-255) 0:normal + * + * @brief Set the background blackness value + * @param value Set the background blackness value + * + */ +- (void)cpclSetBackgroundBlacknessValue:(NSInteger)value; + +/*! + * \~chinese + * + * 设置背景文字. + * + * @brief 设置背景文字. + * @param font 字体 + * @param rotate 文字旋转方向 + * @param fontSize 字体大小 + * @param xPos 起始位置xPos + * @param yPos 起始位置yPos + * @param text 打印内容 + * + * \~english + * + * set back text,Some models are not supported. + * + * @brief set back text. + * @param font text font. + * @param rotate text rotate. + * @param fontSize Size identifier for the font + * @param xPos x-coordinate of start point + * @param yPos y-coordinate of start point + * @param text The text data to be printed + */ +- (void)cpclBackTextWithFont:(PTCPCLTextFontName)font + rotate:(PTCPCLStyleRotation)rotate + fontSize:(NSInteger)fontSize + xPos:(NSInteger)xPos + yPos:(NSInteger)yPos + text:(NSString *_Nonnull)text; + +/*! + * \~chinese + * + * 获取打印机SN号 + * + * @brief 获取打印机SN号 + * + * \~english + * + * get printer serial number. + * + * @brief get printer serial number. + * + */ +- (void)cpclGetPrinterSN; + +/*! + * \~chinese + * + * 设置纸张类型1,A400\A300S\A300L不支持该接口 + * + * @brief 设置纸张类型1 + * @param type 纸张类型 + * + * \~english + * + * set the paper type1,A400\A300S\A300L does not support this interface + * + * @brief set the paper type1. + * @param type paper type. + * + */ +- (void)cpclPaperTypeWithType:(PTCPCLPaperType)type; + +///////////////////////////////////////////////////////////////////// +/****************** A400\A300S\A300L For Paper Type ****************/ +///////////////////////////////////////////////////////////////////// +/*! + * \~chinese + * + * 设置纸张类型2,A400\A300S\A300L机型支持该接口 + * + * @brief 设置纸张类型2 + * @param type 纸张类型 + * + * \~english + * + * set the paper type2,A400\A300S\A300L supports this interface + * + * @brief set the paper type2 + * @param type paper type. + * + */ +- (void)setPrinterPaperTypeFor4Inch:(PTCPCLNewPaperType)type; + +/*! + * \~chinese + * + * 设置打印浓度. + * + * @brief 设置打印浓度. + * @param density 0-2 + * + * \~english + * + * set the darkness of the printout from the printer + * + * @brief set the darkness of the printout from the printer + * @param density 0-2 + * + */ +- (void)setPrinterDensity:(NSInteger)density; + +/*! + * \~chinese + * + * 获取打印浓度 + * + * @brief 获取打印浓度 + * + * \~english + * + * get printer density. + * + * @brief get printer density. + * + */ +- (void)getPrinterDensity; + +/*! + * \~chinese + * + * 获取电量,该接口为自定义功能,部分机型才支持 + * + * @brief 获取电量,<000902> 表示92% + * + * \~english + * + * get Printer Battery,This interface is a custom function, which is only supported by some models + * + * @brief get Printer Battery,<000902> is 92% + * + */ +- (void)getPrinterBattery; + + +///////////////////////////////////////////////////////////////////// +/***************** Line Print Commands *******************/ +///////////////////////////////////////////////////////////////////// + +/*! + * \~chinese + * + * 行模式开启. + * + * @brief 行模式开启. + * + * \~english + * + * start utilities sessions. + * + * @brief start utilities sessions. + * + */ +- (void)cpclUtilitySession; + +/*! + * \~chinese + * + * 单行功能会话前缀 + * + * @brief 单行功能会话前缀 + * + * \~english + * + * prefix if a single line utilities session. + * + * @brief prefix if a single line utilities session. + * + */ +- (void)cpclLineMode; + + +/*! + * \~chinese + * + * 设置左边距 + * + * @brief 设置左边距 + * @param offset 距离左边的偏移量. + * + * \~english + * + * Set margin + * + * @brief Set margin + * @param offset Specifics the distance from the left edge in units + * + */ +- (void)cpclLineMargin:(NSInteger)offset; + +/*! + * \~chinese + * + * 走纸一行 + * + * @brief 走纸一行 + * + * \~english + * + * feed + * + * @brief feed + * + */ +- (void)cpclLineFeed; + +/*! + * \~chinese + * + * 设置走纸 + * + * @brief 设置走纸 + * @param amount 走纸多少个点. -4000~4000dots + * + * \~english + * + * Set feed + * + * @brief Set feed + * @param amount How much to feed in units.-4000~4000dots + * + */ +- (void)cpclFeed:(NSInteger)amount; + +/*! + * \~chinese + * + * 设置打印标签之前的偏移量 + * + * @brief 设置打印标签之前的偏移量 + * @param amount 移动多少个点. 0~4000dots + * + * \~english + * + * when used in a label session, is used to perform an additional media movement before a label is printed + * + * @brief Set the print label before the offset + * @param amount How much to feed in units.0~4000dots + * + */ +- (void)cpclReverse:(NSInteger)amount; + +/*! + * \~chinese + * + * 设置打印速度. + * + * @brief 设置打印速度. + * @param value 打印速度,0-5. + * + * \~english + * + * set the maximum speed at which printout occurs. + * + * @brief set the maximum speed at which printout occurs. + * @param value speed to print in an arbitrary scale,0-5. + * + */ +- (void)cpclSpeed:(NSInteger)value; + +/*! + * \~chinese + * + * 打印结束后定位至下个黑标或标签缝,用于标签纸打印. + * + * @brief 定位下个标签. + * + * \~english + * + * the printer should attempt to synchronize to a mark or gap on the media after the label is printed,Used for label paper printing. + * + * @brief Positioning label + * + */ +- (void)cpclForm; + +/*! + * \~chinese + * + * 设置打印浓度. + * + * @brief 设置打印浓度. + * @param value 输出浓度, -100~200.默认是0 + * + * \~english + * + * set the darkness of the printout from the printer.default:0 + * + * @brief set the darkness of the printout from the printer + * @param value darkness of the printout, -100~200. + * + */ +- (void)cpclTone:(NSInteger)value; + +/*! + * \~chinese + * + * 设置标签或行打印文本朝向. + * + * @brief 设置标签或行打印文本朝向. + * @param degrees 朝向,0 或 180. + * + * \~english + * + * changes the orientation of the printed label or of line print text + * + * @brief changes the orientation of the printed label or of line print text + * @param degrees The orientation of the label, 0 or 180. + * + */ +- (void)cpclTurn:(NSInteger)degrees; + + +///////////////////////////////////////////////////////////////////// +/****************** Utility and Diagnostic Commands ****************/ +///////////////////////////////////////////////////////////////////// + + +/*! + * \~chinese + * + * 纸张学习指令,如果打印机显示纸用尽的时候,在合盖无纸的状态下发送该指令 + * + * @brief 纸张学习指令. + * + * \~english + * + * Paper learning instructions.If the printer shows that the paper is out of paper, send the instruction in the state of closing the paper + * + * @brief Paper learning instructions + * + */ +- (void)setPaperLearn; + +/*! + * \~chinese + * + * 设置QRCode的版本,version的范围在0-25,当等于0时,表示程序用自动的;1-25时,表示用现在设置的大小(部分机型支持). + * + * @brief 设置QRCode的版本 + * @param density 0-25 + * + * \~english + * + * Set the QRCode version,the range of version is 0-25, when it is equal to 0, it means that the program uses automatic; 1-25, it means that the size set now,some models are supported + * + * @brief Set the version of QRCode + * @param density 0-25 + * + */ +- (void)setQRCodeVersion:(NSInteger)version; + +/*! + * \~chinese + * + * 获取QRCode的版本,部分机型支持 + * + * @brief 获取QRCode的版本 + * + * \~english + * + * Get the QRCode version,some models are supported + * + * @brief Get the QRCode version + * + */ +- (void)getQRCodeVersion; + +/*! + * \~chinese + * + * 获取打印机型号,A300S部分固件版本支持 + * + * @brief 获取打印机型号 + * + * \~english + * + * Get printer model,Part of the A300S firmware version is supported + * + * @brief Get printer model + * + */ +- (void)cpclGetPrinterModel; + +///////////////////////////////////////////////////////////////////// +/********************* Codepage Commands ********************/ +///////////////////////////////////////////////////////////////////// + +/*! + * \~chinese + * + * 设置字符代码页. + * + * @brief 设置字符代码页. + * @param codepage "USA" "FRANCE" "GERMANY" "UK" "DENMARK" "SWEDEN" "ITALY" "SPAIN" "JAPAN-S" "NORWAY" "DENMARK II" "SPAIN II" "LATIN9" "KOREA" "SLOVENIA" "CHINA" "BIG5" "CP874" "CP850" "CP437" "CP860" "CP863" "CP865" "CP866" "CP852" "CP858" "CP857" "CP737" "CP720" "CP775" "CP855" "CP862" "CP864" "ISO8859-6" "ISO8859-8" "ISO8859-9" "ISO8859-15" "WPC1252" "WPC1250" "WPC1251" "WPC1252" "WPC1254" "WPC1255" "WPC1256" "ISO8859-1" "ISO8859-2" "ISO8859-3" "ISO8859-4" "ISO8859-5" "TIS11" "TIS18" "WPC1258" "UnicodeBigUnmarked" + * + * \~english + * + * Set Character CodePage + * + * @brief Set Character CodePage + * @param codepage "USA" "FRANCE" "GERMANY" "UK" "DENMARK" "SWEDEN" "ITALY" "SPAIN" "JAPAN-S" "NORWAY" "DENMARK II" "SPAIN II" "LATIN9" "KOREA" "SLOVENIA" "CHINA" "BIG5" "CP874" "CP850" "CP437" "CP860" "CP863" "CP865" "CP866" "CP852" "CP858" "CP857" "CP737" "CP720" "CP775" "CP855" "CP862" "CP864" "ISO8859-6" "ISO8859-8" "ISO8859-9" "ISO8859-15" "WPC1252" "WPC1250" "WPC1251" "WPC1252" "WPC1254" "WPC1255" "WPC1256" "ISO8859-1" "ISO8859-2" "ISO8859-3" "ISO8859-4" "ISO8859-5" "TIS11" "TIS18" "WPC1258" "UnicodeBigUnmarked" + * + */ +- (void)cpclSetCharacterCodePage:(NSString *_Nonnull)codepage; + + /*! + * \~chinese + * + * 查询高棉语开启状态,00 00:关闭; 01 00:开启 + * + * @brief 查询阿拉伯语变形状态 + * + * \~english + * + * Get Khmer status:00 00:close; 01 00:open + * + * @brief Get Khmer status + * + */ +- (void)cpclSearchKhmerState; + +/*! + * \~chinese + * + * 设置高棉语开关状态,打印其他代码页需要先关闭高棉语模式再切换代码页设置模式,打印高棉语时先开启高棉语模式,然后调用cpclSetKhmerCodepage + * + * @brief 设置高棉语开关状态 + * @param state 0:关闭; 1:开启 + * + * \~english + * + * Set the Khmer language switch. To print other code pages, close the Khmer language mode first and then switch the code page setting mode. When printing Khmer language, open the Khmer language mode first,and invoke 'cpclSetKhmerCodepage' + * + * @brief Set Khmer on/off state + * @param state 0:close; 1:open + * + */ +- (void)cpclSetKhmerState:(NSInteger)state; + +/*! + * \~chinese + * + * 设置高棉语代码页,在该代码页下支持8号字体55号字体打印中文,打印完后要退出高棉语模式,调用cpclExitKhmerMode + * + * @brief 查询阿拉伯语变形状态 + * + * \~english + * + * Set the Khmer language code page, under which Chinese is printed with font size of 8 and font size of 55. After printing, exit Khmer mode and call cpclExitKhmerMode + * + * @brief Set Khmer codepage + * + */ +- (void)cpclSetKhmerCodepage; + +/*! + * \~chinese + * + * 退出高棉语模式 + * + * @brief 退出高棉语模式 + * + * \~english + * + * Exit Khmer language mode + * + * @brief Exit Khmer language mode + * + */ +- (void)cpclExitKhmerMode; + +/*! + * \~chinese + * + * 阿拉伯语变形,设置后重启打印机 + * + * @brief 阿拉伯语变形,设置后重启打印机 + * @param function 48:关闭; 49:变形1,按单词排序;50:变形2,按短语排序;51:变形3,按完整规则排序 + * + * \~english + * + * Arabic transform + * + * @brief Arabic transform + * @param function 48:close; 49:Sort by word;50:Phrase sort;51:Sort by complete rules + * + */ +- (void)cpclSetArabicTransformFunction:(NSInteger)function; + +/*! + * \~chinese + * + * 查询阿拉伯语变形状态,00 00:关闭; 01 00:变形1; 02 00:变形2; 03 00:变形3 + * + * @brief 查询阿拉伯语变形状态 + * + * \~english + * + * get Arabic status:00 00:close; 01 00:Sort by word; 02 00:Phrase sort; 03 00:Sort by complete rules + * + * @brief get Arabic status + * + */ +- (void)cpclGetArabicTransformStatus; + + +/*! + * \~chinese + * + * 泰文变形开启 + * + * @brief 泰文变形开启 + * @param status 48:close 49:open + * + * \~english + * + * Thai transform status + * + * @brief Thai transform status + * @param status 48:close 49:open + * + */ +- (void)cpclSetThaiTransformStatus:(NSInteger)status; + + +/*! + * \~chinese + * + * 越南语变形,设置后重启打印机. + * + * @brief 越南语变形,设置后重启打印机. + * @param function 48:关闭; 49:ASCII输入; 50:UTF-8输入 + * + * \~english + * + * Set Vietnamese Transform + * + * @brief Set Vietnamese Transform + * @param function 48:close; 49:ASCII; 50:UTF-8 + * + */ +- (void)cpclSetVietnameseTransformFunction:(NSInteger)function; + +/*! + * \~chinese + * + * 查询越南语变形状态,00 00:关闭; 01 00:ASCII输入; 02 00:UTF-8输入; + * + * @brief 查询越南语变形状态 + * + * \~english + * + * get Vietnamese status:00 00:close; 01 00:ASCII; 02 00:UTF-8; + * + * @brief get Vietnamese status + * + */ +- (void)cpclGetVietnameseTransformStatus; + + + +@end + + + + + + + + diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTCommandCommon.h b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandCommon.h new file mode 100644 index 0000000..ac1ec15 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandCommon.h @@ -0,0 +1,47 @@ +/*! + * \~chinese + * @header PTCommandCommon.h + * @abstract 公共指令 + * + * \~english + * @header PTCommandCommon.h + * @abstract Common Command + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PTCommandCommon : NSObject + +@property(nonatomic, strong) NSMutableData * _Nonnull cmdData; + +/// 获取打印机型号,回的数据格式:51333142 5400 +- (void)getPrinterModelName; + +/// 获取打印机固件版本号,版本号返回格式为 X.XX.XX或X.X.X【如1.01.01或1.0.3】 +- (void)getPrinterFirmwareVersion; + +/// OTA蓝牙固件升级,该功能需要打印机支持 +- (void)updateOTABleFirmwareWithData:(NSData *)data; + +//=========================固件升级旧的方式================= + +/// 打印机固件升级(固定包大小) +/// @param data 固件数据 +- (void)updatePrinterFirmwareWithData:(NSData *)data; + +//=========================固件升级新的方式================= +/// 获取升级固件每包的大小 +- (void)getUpdatePrinterFirmwarePackage; + + +/// 升级打印机固件 +/// @param data 固件数据 +/// @param package 每包大小 +- (void)updateDeviceFirmwareWithData:(NSData *)data package:(NSInteger)package; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTCommandESC.h b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandESC.h new file mode 100644 index 0000000..4560f6b --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandESC.h @@ -0,0 +1,1795 @@ +/*! + * \~chinese + * @header PTCommandESC.h + * @abstract ESC指令 + * + * \~english + * @header PTCommandESC.h + * @abstract ESC Command + */ + +#import +#import "PTBitmap.h" + +typedef NS_ENUM(NSInteger, ESCText) { + + ESCTextNormal = 0, + ESCTextMini = 1, + ESCTextBold = 8, + ESCTextDoubleHeight = 16, + ESCTextDoubleWidth = 32, + ESCTextUnderline = 128, +}; + +typedef NS_ENUM(NSInteger, ESCBarcode) { + + ESCBarcodeB_UPCA = 65, + ESCBarcodeB_UPCE = 66, + ESCBarcodeB_EAN13 = 67, + ESCBarcodeB_EAN8 = 68, + ESCBarcodeB_CODE39 = 69, + ESCBarcodeB_ITF = 70, + ESCBarcodeB_CODEBAR = 71, + ESCBarcodeB_CODE93 = 72, + ESCBarcodeB_CODE128 = 73, +}; + + +/** + * ESC-POS 指令集:大约200个生成指令的函数。 + * ESC-POS command set: about 200 functions which generated into command + */ +@interface PTCommandESC : NSObject + +/** + * 字符串编码格式,默认kCFStringEncodingGB_18030_2000 + * Encoding format of character string, default is kCFStringEncodingGB_18030_2000 + */ +@property (nonatomic, assign) NSStringEncoding encoding; + +@property (nonatomic, strong) NSMutableArray *cmdQueue; + +- (void)initCommandQueue; + +- (void)appendCommandData:(NSData *)cmdData; + +- (NSData *)getCommandData; + +- (void)appendText:(NSString *)text; + +/** + get printer status + 第一个字节:第2位是1时开盖,0的时候合盖 + 第二个字节:第5、6位都是1的时候缺纸,否则是有纸 + */ +- (void)getPrinterStatus; + +/** 打印自检页 + * Print SelfTest + */ +- (void)printSelfTest; + +/** 打印并走纸一行 + * Print and feed one line + */ +- (void)printAndLineFeed; + +/** 回车 Carriage return */ +- (void)printAndCarriageReturn; + +/** + 打印状态回调开关 + automatic return + + @param flag true:开启自动回传状态 false:关闭自动回传 + */ +- (void)turnOnPrintStatusCallBack:(BOOL)flag; + +/** + * page 73. 打印并走纸 + * Print and feed paper + * @param offset (0~255) + */ +- (void)printAndFeed:(NSInteger)offset; + +/** + * page 76. 打印并回纸 + * Print and retreat paper + * @param offset (0~48) + */ +- (void)printAndReverseFeed:(NSInteger)offset; + +/** + * page 78. 打印并向前走纸n行 + * Print and feed n lines forward + * @param lines (0~255) + */ +- (void)printAndFeedLines:(NSInteger)lines; + +/** + * page 80. 打印并回纸n行 + * Print and retreat n line + * @param lines (0~2) + */ +- (void)printAndReverseFeedLines:(NSInteger)lines; + +/** + * page 83. 设置默认行距 + * Set line spacing default + */ +- (void)setLineSpacingDefault; + +/** + * page 85. 设置行距 + * Set line spacing + * @param spacing (0~255) + */ +- (void)setLineSpacing:(NSInteger)spacing; + +#pragma mark Character Commands + +/** + * page 91. 设置右边字符间隔 + * Set character spacing on the right + * @param spacing (0~255) + */ +- (void)setRightCharacterSpacing:(NSInteger)spacing; + +/** page 93. 设置打印字体模式 + * Set print font mode + */ +- (void)setTextMode:(ESCText)mode; +/** + * page 93. 设置富文本样式,可叠加效果,比如粗体字和下划线 + Set text mode, the effect can be overlapped, like bold and underline + */ +- (void)setTextStyleMini:(BOOL)mini + bold:(BOOL)bold + doubleWidth:(BOOL)doubleWidth + doubleHeight:(BOOL)doubleHeight + underline:(BOOL)underline; + +/** + * page 93 添加文本,并设置字体形式 + * Add text and set text form + * + * @param text text string + * @param mode ESCText + */ +- (void)appendText:(NSString *)text mode:(ESCText)mode; + +/** + * page 98. 设置或取消字符设置 + * Set or cancel character setting + * n = 0, character set cancel [default] + * n = 1, character set selected + * @param set (0~1) + */ +- (void)setUserDefinedCharacterSet:(NSInteger)set; + +/** + * page 99. 定义用户已设定的字符 + * Define user-defined character + * @param codeStart (32~126) + * @param codeEnd (32~126) + * @param horizontal (data.length = 3*horizontal) + * @param data (0~255) + */ +- (void)defineCharactersWithCodeStart:(NSInteger)codeStart + codeEnd:(NSInteger)codeEnd + horizontal:(NSInteger)horizontal + data:(NSData *)data; + +/** + * page 104. 下划线模式开关 + * Underline mode ON/OFF + * 0,48 turns off underline mode + * 1,49 turns on underline mode (1-dot thick) + * 2,50 turns on underline mode (2-dots thick) + * @param underline (0~2,48~50) + */ +- (void)setUnderline:(NSInteger)underline; + +/** + * page 106. 取消用户已设定的字符 + * Cancel user-defined character + * @param n (32~126) + */ +- (void)cancelUserDefinedCharacters:(NSInteger)n; + +/** + * page 108. 字符加粗开关 + * Character bold ON/OFF + * n = 0 [default] + * @param bold (0~255) + */ +- (void)setBold:(NSInteger)bold; + +/** + * page 109. 字符黑体字开关 + * Character black ON/OFF + * n = 0 [default] + * + * @param doubleStrike (0~255) + */ +- (void)setDoubleStrike:(NSInteger)doubleStrike; + +/** + * page 110. 设置字符字体类型 + * Set character font type + * @param font (0~1) 0:fontA 1:fontB + */ +- (void)setCharacterFont:(NSInteger)font; + +/** ESC R + * page 115. 设置国际字符设定 + * Set International character set + * @param set (n<=15) + */ +- (void)setInternationalCharacterSet:(NSInteger)set; + +/** ESC V + * page 117. 顺时针旋转90度开关 + * 90° clockwise ON/OFF + * @param mode (0~2),(48~50) + */ +- (void)setVerticalMode:(NSInteger)mode; + +/** ESC r + * page 119. 设置打印颜色 + * Set print color + * n = 0 [default] + * 0,48 black + * 1,49 red + * @param color (0,1,48,49) + */ +- (void)setPrintColor:(NSInteger)color; + +/** ESC t + * page 121. 设置字符编码表 for Portable machine + * Set character encoding table + * + * @param table (0~5),(13-21),(26),(32-34)(36,37),(39,40),(45-52) + */ +- (void)setCharacterCodeTable:(NSInteger)table; + +/// codepage,for POS Printer +/// @param codepage (0~5),(13~21),26,32-34,36,37,39-40,45-52 +- (void)setPrinterCodepage:(NSInteger)codepage; + +/** + 字符变形 + Character Transform + + @param mode 0:close;1:变形,按单词排序 2:变形,按短语排序 3:变形,按完整规则排序 + */ +- (void)setCharacterTransformMode:(NSInteger)mode; + +/** 进入保存模式 */ +- (void)enterPrinterSaveMode; + +/** 退出保存模式 */ +- (void)exitPrinterSaveMode; + +/** 获取越南语变形模式 00 00:为关 01 00:ASCII输入,02 00:utf-8输入 */ +- (void)getVietnamTransformMode; + +/** 设置越南语变形模式,设置后重启打印机 48:为关 49:ASCII输入,50:utf-8输入 */ +- (void)setVietnamTransformMode:(NSInteger)mode; + +/** + 泰文变形开启 + + @param status 48:close 49:open + */ +- (void)setThaiTransformStatus:(NSInteger)status; + +/** + language mode + 设置简体中文/英文/繁体中文模式 + + @param mode 0:SimplifiedChinese 1:English 2:TraditionalChinese + */ +- (void)setPrinterLanguageMode:(NSInteger)mode; + +/** ESC { + * page 124. 颠倒打印开关 + * Reverse print ON/OFF + * @param mode (0~255) + */ +- (void)setUpToDownMode:(NSInteger)mode; + +#pragma mark GS ( N + +/** GS ( N + * page 128. 设置字符颜色 + * Set character color + * color = 49 [default] + * + * @param color (58~51) + */ +- (void)setCharacterColor:(NSInteger)color; + +/** GS ( N + * page 130. 设置背景颜色 + * Set background color + * m = 48 [default] + * 48 none; 49 clolor1; 50 color2; 51 color3 + * @param color (48~51) + */ +- (void)setBackgroundColor:(NSInteger)color; + +/** GS ( N + * page 132. 阴影模式开关 + * Shadow mode ON/OFF + * + * @param mode (0,1,48,49) + * @param color (48~51) 48 none; 49 clolor1; 50 color2; 51 color3 + */ +- (void)setShadowMode:(NSInteger)mode color:(NSInteger)color; + +/** GS ! + * page 134. 设置字符大小 + 8 Set character size + * n = 0 [default] + */ +- (void)setCharacterSize:(NSInteger)size; +- (void)setCharacterWidth:(NSInteger)width height:(NSInteger)height; + +/** + Set character size + 选择字符大小 + + @param size 0-13 2x2:fontB 3x3:fontA + 0:2x2mm,1:3x3mm,2:4x4mm,3:6x6mm,4:8x8mm,5:9x9mm,6:10x10mm + 7:12x12mm,8:14x14mm,9:15x15mm,10:16x16mm,11:18x18mm,12:21x21mm,13:24x24mm + */ +- (void)setCharacterMultipleSize:(NSInteger)size; + + +/// 设置中文的思源字体大小 +/// @param size 字体大小:size = 33(42dot) ,34(36dot), 35(32dot) +- (void)setChineseSesBlackFontWithSize:(NSInteger)size; + +/// 设置英文的思源字体大小 +/// @param size 字体大小size = 33(42dot) ,34(36dot), 35(32dot) +- (void)setEnglishSesBlackFontWithSize:(NSInteger)size; + +/** GS B + * page 136. 黑白反向打印模式 + * Black and white reverse print mode + * n = 0 [default] + * + * @param reverse (0~255) + */ +- (void)setReverse:(NSInteger)reverse; + +/** GS b + * page 138. 平滑模式开关 + * Smooth mode ON/OFF + * mode = 0 [default] + * + * @param smooth (0~255) + */ +- (void)setSmooth:(NSInteger)smooth; + +#pragma mark Panel Button Commands + +/** + * page.140 激活/关闭面板按钮 + * Enable / disable panel button + * n = 0 enable [default] + * n = 1 disable + * + * @param mode (0~255) + */ +- (void)setPanelButtonMode:(NSInteger)mode; + +/** + * page 145. 是否使用纸尽传感器 + * Whether to use paper out sensor + */ +- (void)enableOutPaperSensor:(BOOL)enable; + +/** + * page 147. 设置停止打印传感器 + * Set stop print sensor + */ +- (void)enableStopPrintSensor:(BOOL)enable; + +#pragma mark Print Positioin Commands(Page Mode) + +/** 打印并回到标准模式 + * Print and return to standard mode + */ +- (void)printAndReturnStandardMode; + +/** 在页模式下取消打印数据 + * Cancel print data in page mode + */ +- (void)cancelPrint; + +/** 在页模式下打印数据 + * Print data in page mode + */ +- (void)printDataInPageMode; + +/// 定位到下个缝标,行模式下使用 +- (void)setPrinterAutomaticPosition; + +/// 定位到下个缝标,页模式下使用 +- (void)positionNextLabel; + +/** + * page 151. 横向跳格 + * Set horizontal tab + */ +- (void)setHorizontalTab; + +/** + * page 152. 设置绝对打印位置 + * Set absolute print position + * + * @param position 0-255 + */ +- (void)setAbsolutePosition:(NSInteger)position; + +/** + * page 154. 设置横向跳格位置 + * Set horizontal tab position + */ +- (void)setHorizontalTabPositionsData:(NSData *)data; + +/** + * page 156. 在页模式下设置打印方向 + * Set print direction in page mode + * 0,48 left to right + * 1,49 bottom to top + * 2,50 right to left + * 3,51 top to bottom + + * @param direction (0~3),(48~51) + */ +- (void)pageSetPrintDirection:(NSInteger)direction; + +/** + * page 158. 在页模式下设置打印区域 + * Set print area in page mode + * + * @param xPos (0~65535) + * @param yPos (0~65535) + * @param width (0~65535) + * @param height (0~65535) + */ +- (void)pageSetPrintAreaWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + width:(NSInteger)width + height:(NSInteger)height; + +/** + * page 163. 设置相对打印位置 + * Set relative print position + * + * @param position (-32768 ~ 32767) + */ +- (void)setRelativePosition:(NSInteger)position; + +/** + * page 165. 设置对齐方式 + * Set justification + * n = 0 [default] + * 0,48 left justification + * 1,49 centered + * 2,50 right justification + * + * @param justification (0~2),(48~50) + */ +- (void)setJustification:(NSInteger)justification; + +/** + * page 167. 在页模式下设置绝对垂直打印位置 + * Set absolute vertical print position in page mode + * @param yPos (0~65535) + */ +- (void)pageSetAbsoluteYPos:(NSInteger)yPos; + +/** + * page 169. 设置左边空白宽度 + * Set left margin width + * @param left 左对齐 (0~65535) + */ +- (void)setLeftMargin:(NSInteger)left; + +/** + * page 171. 设置起始打印行位置 + * Set start print position + * 0,48 cancel data in the current print buffer. + * 1,49 print data in the current print buffer. + * + * @param mode (0,1,48,49) + */ +- (void)setLinePrintPositionMode:(NSInteger)mode; + +/** + * page 173. 设置打印区域宽度 + * Set print area width + * @param width (0~65535) + */ +- (void)setPrintAreaWidth:(NSInteger)width; + +/** + * page 177. 在页模式下设置相对垂直打印位置 + * Set relative vertical print position in page mode + * @param yPos (-32767 ~ 32768) + */ +- (void)pageSetRelativeYPos:(NSInteger)yPos; + +#pragma mark Bit Image Commands + +/** + * page 180. 设置位图模式 + * Set bitmap mode + * @param mode (0~1),(31~32) + * @param width (1~2047) + * @param data (0~255) + */ +- (void)setImageMode:(NSInteger)mode imageWidth:(NSInteger)width data:(NSData *)data; + +/** + * page 194. 打印NV位图 + * Print NV bitmap + * @param imageID (1~255) + * @param mode (0,48:Normal),(1,49:Double-width),(2,50:Double-height),(3,51:Quadruple) + */ +- (void)setNVBitImage:(NSInteger)imageID Mode:(NSInteger)mode; + +/** + * page 210. 传输NV图形内存容量 + * Transmit NV graphic memory size + * @param size 0,48 + */ +- (void)setNVGraphicsMemorySize:(NSString *)size; + +/** + * page 212. 设置图形点密度标准 + * Set graphic dot density + * @param fn 1,49 + * @param x 50,51 + */ +- (void)setGraphicDotDensity:(NSInteger)fn x:(NSInteger)x; + +/** + * page 214. 打印在打印缓存的图形数据 + * Print graphic data in buffer + * @param fn 2,50 + */ +- (void)printBufferGraphic:(NSInteger)fn; + +/** + * page 215. 传输NV图形内存剩余容量 + * Transmit graphic remaining memory + * @param fn 3,51 + */ +- (void)transmitGraphicRemainingMemory:(NSInteger)fn; + +/** + * page 216. 传输下载图形内存的剩余容量 + * Transmit downloaded graphic remaining memory + * @param fn 4,52 + */ +- (void)transmitDownloadGraphicRemainingMemory:(NSInteger)fn; + +/** + * page 218. 传输已定义NV图形键值表 + * Transmit defined NV graphic key code list + */ +- (void)transmitNVGrapihcKeyCodeList; + +/** + * page 220. 删除所有NV图形数据 + * Delete all the NV graphic data + */ +- (void)deleteNVGraphicAll; + +/** + * page 221. 删除指定的NV图形数据 + * Delete the defined NV graphic data + * @param keycode1 (32~126) + * @param keycode2 (32~126) + */ +- (void)deleteNVGraphicWithKeycode1:(NSInteger)keycode1 keycode2:(NSInteger)keycode2; + +/** + * page 222. 定义NV像素图图形数据 + * Define raster NV graphic data + * @param keycode (32~126) + * @param keycode2 (32~126) + * @param imageWidth (1~8192) + * @param imageHeight (1~2304) + * @param data imageData + */ +- (void)defineRasterNVGraphicData:(NSData *)data + keycode:(NSInteger)keycode + keycode2:(NSInteger)keycode2 + imageWidth:(NSInteger)imageWidth + imageHeight:(NSInteger)imageHeight; + +/** + * page 227. 定义所有NV纵列图形数据 + * Define column NV graphic data + * @param keycode (32~126) + * @param keycode2 (32~126) + * @param imageWidth (1~8192) + * @param imageHeight (1~2304) + * @param data imageData + */ +- (void)defineColumnNVGraphicData:(NSData *)data + keycode:(NSInteger)keycode + keycode2:(NSInteger)keycode2 + imageWidth:(NSInteger)imageWidth + imageHeight:(NSInteger)imageHeight; + +/** + * page 231. 打印指定的NV图形数据 + * Print specified NV graphic data + * @param keycode (32~126) + * @param keycode2 (32~126) + * @param xScale 1,2 + * @param yScale 1,2 + */ +- (void)printNVGraphicWithKeycode:(NSInteger)keycode + keycode2:(NSInteger)keycode2 + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale; + +/** + * page 238. 传输已定义下载图形键值表 + * Transmit defined downloaded graphic key code list + */ +- (void)transmitGraphicKeycodeList; + +/** + * page 240. 删除所有NV图形数据 Delete all the NV graphic data + */ +- (void)deleteDownloadedNVGraphicAll; + +/** + * page 241. 打印指定的NV图形数据 Print defined NV graphic data + * + * @param keycode (32~126) + * @param keycode2 (32~126) + */ +- (void)deleteDownloadedNVGraphicKeycode:(NSInteger)keycode keycode2:(NSInteger)keycode2; + +/** + * page 242. 定义已下载的光栅格式图形数据 + * Defined downloaded raster NV graphic data + * @param keycode (32~126) + * @param keycode2 (32~126) + * @param imageWidth (1~8192) + * @param imageHeight (1~2304) + * @param data imageData + */ +- (void)defineDownloadedRasterNVGraphicData:(NSData *)data + keycode:(NSInteger)keycode + keycode2:(NSInteger)keycode2 + imageWidth:(NSInteger)imageWidth + imageHeight:(NSInteger)imageHeight; + +/** + * page 246. 定义已下载的列格式图形数据 + * Define downloaded column NV graphic data + * @param keycode (32~126) + * @param keycode2 (32~126) + * @param imageWidth (1~8192) + * @param imageHeight (1~2304) + * @param data imageData + */ +- (void)defineDownloadedColumnNVGraphicData:(NSData *)data + keycode:(NSInteger)keycode + keycode2:(NSInteger)keycode2 + imageWidth:(NSInteger)imageWidth + imageHeight:(NSInteger)imageHeight; + +/** + * page 250. 打印指定下载的NV图形数据 a + * Print specified downloaded NV graphic dat + * + * @param keycode (32~126) + * @param keycode2 (32~126) + */ +- (void)printDownloadedNVGraphicWithKeycode:(NSInteger)keycode + keycode2:(NSInteger)keycode2 + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale; + +/** + * page 252. 在打印缓存像素图储存图形数据 Store raster graphic data in print buffer + * Users have the option of specifying horizontal(times bx) * vertical(times by) size setting for the selected data. + * @param xScale (1~2) + * @param yScale (1~2) + * @param imageWidth (1~2047) + * @param imageHeight (1~1662,831,415) + * @param data imageData + */ +- (void)storeRasterGraphicData:(NSData *)data + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + imageWidth:(NSInteger)imageWidth + imageHeight:(NSInteger)imageHeight; + +/** + * page 261. 在打印缓存纵列储存的图形数据 Store column graphic data in print buffer + * Users have the option of specifying horizontal bx * vertical by size setting for the selected data. + * @param xScale (1~2) + * @param yScale (1~2) + * @param imageWidth (1~2047) + * @param imageHeight (1~1662,831,415) + * @param data imageData + */ +- (void)storeColumnGraphicData:(NSData *)data + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + imageWidth:(NSInteger)imageWidth + imageHeight:(NSInteger)imageHeight; + +/** + * page 264. 定义NV位图 Define NV bitmap + * Defines the NV bit image in the NV graphics area. + * @param number (1~255) + */ +- (void)defineNVGraphicData:(NSData *)data number:(NSInteger)number; + +/** + * page 268. 打印像素图位图 + * Print raster bitmap + * @param image source image + * @param mode binary/dithering + * @param compress TIFF/ZPL2/None + * @param package Whether the data is subcontracted + */ +- (void)appendRasterImage:(CGImageRef)image mode:(PTBitmapMode)mode compress:(PTBitmapCompressMode)compress package:(BOOL)package; + +/** + * page 273. 定义下载位图 Defined downloaded bitmap + * + * @param widthBytes (1~255) + * @param heightBytes (1~255) + * @param imageData imageData + */ +- (void)defineDownloadedImage:(NSData *)imageData + widthBytes:(NSInteger)widthBytes + heightBytes:(NSInteger)heightBytes; + +/** + * page 276. 打印已下载的位图 + * Print downloaded bitmap + * (0,48:Normal),(1,49:Double-width),(2,50:Double-height),(3,51:Quadruple) + * + * @param scale (0~3),(48~51) + */ +- (void)printDownloadedImageWithScale:(NSInteger)scale; + +/** + * page 283. 打印可变垂直大小位图 + * Print variable vertical bitmap + */ +- (void)appendColumnImage:(CGImageRef)image scale:(NSInteger)scale; + +#pragma mark Status Commands + +/** + * page 288. 传输实时状态 + * Transmit real-time status + * @param status (1~4),(7~8) 一般选2,4 + */ +- (void)transmitRealTimeStatus:(NSInteger)status; + +/** + * page 305. 传输外部设备状态 + * Transmit peripheral device status + * @param status (0,48) + */ +- (void)transmitPeripheralDeviceStatus:(NSInteger)status; + +/** + * page 306. 传输纸张传感器状态 + * Transmit paper sensor status + */ +- (void)transmitPaperSonsorStatus; + +/** + * page 308. 激活/关闭自动返回状态 + * Enable/disable automatic status back (ASB) + */ +- (void)setASBStatusWithDrawer:(BOOL)drawer + offline:(BOOL)offline + error:(BOOL)error + rollPaper:(BOOL)rollPaper + panelSwitch:(BOOL)panelSwitch; + +/** + * page 322. 激活/关闭油墨自动返回状态 + * Enable/disable ink automatic status back (ASB) + */ +- (void)setInkASBWithOffline:(BOOL)offline detection:(BOOL)detection; + +/** + * page 327. 传输状态 + * Transmit status + * 1,49: transmits paper sensor status + * 2,50: transmits drawer kick-out connector status + * 4,52: transmits ink status + * + * @param status (1,2,4,49,50,52) + */ +- (void)transmitStatus:(NSInteger)status; + +#pragma mark Bar Code Commands + + +/** + * page 334. 设置打印条码数字字体 + * Set font of bar code number + * 0,48 font a + * 1,49 font b + * 2,50 font c + * + * @param font (0~2),(48~50) + */ +- (void)setHRIFont:(NSInteger)font; + +/** + * @param justification page 165. 对齐方式justification Value0,1,2 : left、center、right + * @param type page 339. Value:(A:0~6),(B:65~73) + * @param width page 355. Value:(2~6),(68~76) + * @param height page 337. Value:(1~255) + * @param hri page 332. Value:(0~3),(48~51):无字体,字体在上面、字体在下面、上下都有字体 + * @param data page 339. + */ +- (void)appendBarcode:(ESCBarcode)type + data:(NSString *)data + justification:(NSInteger)justification + width:(NSInteger)width + height:(NSInteger)height + hri:(NSInteger)hri; + +#pragma mark Macro Function Commands + +/** + * page 360. 开始或结束宏定义 + * Start or end macro + */ +- (void)defineMacro; + +/** + * page 362. 执行宏操作 + * Executes a macro 'times' while 'wait_times' * 100 msec for each macro execution,using the mode specified by 'mode' as follows. + * + * @param times (1~255) + * @param waitTimes (0~255) + * @param mode (0,1) + */ +- (void)executeMacroWithTimes:(NSInteger)times + waitTimes:(NSInteger)waitTimes + mode:(NSInteger)mode; + +#pragma mark Mechanism Control Commands + +/** + * page 366. 返回主页 + * Return to homepage + */ +- (void)returnHome; + +/** + * page 367. 打开/关闭单向打印模式 + * Turn on/off unidirectional print mode + * + * @param mode (0~255) + */ +- (void)setUnidirectionalPrintMode:(NSInteger)mode; + +/** + * page 368. 局部切纸 + * Partial cut + */ +- (void)setPartialCut1; + +/** + * page 370. 局部切纸 + * Partial cut + */ +- (void)setPartialCut3; + +/// Partial +/// 半切 +- (void)setPartialCut; + +/// Full +/// 全切 +- (void)setFullCut; + +/// 打印并半切距离 +/// @param distance distance = 15mm + n * 0.0625 +- (void)setPartialCutWithDistance:(NSInteger)distance; + +/// 打印并全切距离 +/// @param distance distance = 15mm + n * 0.0625 +- (void)setFullCutWithDistance:(NSInteger)distance; + +/** + * page 372. 设置剪纸模式并剪纸 + * Set cut mode and cut the paper + * + * @param mode (0,1,48,49) + * @param distance (0~255) + */ +- (void)setCutMode:(NSInteger)mode distance:(NSInteger)distance; + + +/// kick Cashdrawer/弹出钱箱 +/// @param number 0-2 0:1# 1:2# 2:all +- (void)kickCashdrawer:(NSInteger)number; + + +/// get Cashdrawer status: 1--close 0--open +- (void)getPrinterCashdrawerStatus; + + +// 如果打印机没有开启黑标功能,那么下面的几条指令可以帮助你 +// If the printer does not have the black mark function enabled, then the following instructions can help you +#pragma mark Black mark Commmands + +/// 设置是否开启黑标 +/// @param status 0:close 1:open +- (void)setPrinterBlackMarkStatus:(NSInteger)status; + +/// 设置黑标是否开启自动定位 +/// @param location 0:close 1:open +- (void)setPrinterBlackMarkAutoLocation:(NSInteger)location; + +/// 设置黑标自动定位后是否切刀 +/// @param location 0:close 1:open +- (void)setPrinterBlackMarkCutAfterAutoLocation:(NSInteger)location; + +#pragma mark Miscellaneous Commands + +/** + * page 380. 发送实时请求 + * Send real-time request + * + * @param request (1~2) + */ +- (void)sendRealTimeRequest:(NSInteger)request; + +/** + * page 385. 实时脉冲 + * Real-time pulse + * + * @param mode 0,1 + * @param time (1~8) + */ +- (void)generatePulseWithMode:(NSInteger)mode Time:(NSInteger)time; + +/** + * page 388. 执行关机事件 + * Execute power off sequence + */ +- (void)executePowerOffSequence; + +/** + * page 391. 实时传输指定状态 + * Transmit specified status in real time + * + * @param status 1,5 + */ +- (void)transmitSpecifiedStatus:(NSInteger)status; + +/** + * page 396. 清除缓存 + * Clear buffer + */ +- (void)clearBuffer; + +/** + * page 405 + * + * @param times (0~63) + * @param t1 (0~255) + * @param t2 (0~255) + */ +- (void)escBeepIntegratedBeeperWithTimes:(NSInteger)times T1:(NSInteger)t1 T2:(NSInteger)t2; + +/** + * page 406 + * + * @param a (48~51) + * @param times 0,255 + * @param t1 (1~50,255) + * @param t2 (1~50) + */ +- (void)escSetIntegratedBeeperWhenOfflineFactorsOccurA:(NSInteger)a Times:(NSInteger)times T1:(NSInteger)t1 T2:(NSInteger)t2; + +/** + * page 408 + * + * @param times 0,255 + * @param t1 (1~50,255) + * @param t2 (1~50) + */ +- (void)escSetIntegratedBeeperExceptWhenOfflineFactorsOccurWithTimes:(NSInteger)times T1:(NSInteger)t1 T2:(NSInteger)t2; + +/** + * page 410. 设置外围设备 + * Select peripheral device + * 1,3 enables printer + * 2 disables printer + * + * @param mode (1~3) + */ +- (void)escSelectPeripheralDevice:(NSInteger)mode; + +/** + * page 412. 初始化打印机 + * Initialize printer + */ +- (void)initializePrinter; + +/** + * 清空打印机缓存 + * clear buffers + */ +- (void)clearPrinterBuffer; + +/** + * page 413. 设置页模式 + * Set page mode + */ +- (void)setPageMode; + +/** + * page 416. 设置标准模式 + * Set standard mode + */ +- (void)setStandardMode; + +/** + * page 418. 发射脉冲 + * Generate pulse pin mode + * 0,48: drawer kick-out connector pin 2 + * 1,49: drawer kick-out connector pin 5 + * + * @param pin_mode 0,1,48,49 + * @param on_time (0~255) + * @param off_time (0~255) + */ +- (void)escGeneratePulsePinMode:(NSInteger)pin_mode ONTime:(NSInteger)on_time OFFTime:(NSInteger)off_time; + +/** + * page 420. 执行测试打印 + * Execute test print + * + * @param type (0,1,2),(48,49,50) + * @param mode (1,2,3),(49,50,51),64 + */ +- (void)escExecuteTestPrintType:(NSInteger)type Mode:(NSInteger)mode; + +/** + * page 424. 激活/关闭实时命令 + * Enable/disable real-time command + * + * @param cmdLength (3,5) + * @param type (1,2) + * @param mode (0,1,48,49) + */ +- (void)escSetRealTimeCommandLength:(NSInteger)cmdLength type:(NSInteger)type mode:(NSInteger)mode; + +/** + * page 427. 请求传输响应或状态 + * Request transmission of response or status + */ +- (void)escRequestTransmissionOfResponseOrStatus; + +/** + * page 445. 选择打印控制方法 + * Select print control mode + * 0,48: print mode when power is turned on + * (1,49: mode1), (2,50:mode2), (3,51:mode3), (4,52:mode4) + * + * @param mode (0,4),(48,52) + */ +- (void)escSelectPrintControlMode:(NSInteger)mode; + +/** + * page 448. 选择打印浓度 + * Set print density + * + * @param density (250~255),(0~6) + */ +- (void)setDensity:(NSInteger)density; + +/** + * page 451. 选择打印速度 + * Set print speed + * + * @param speed (0~11),(48~57) + */ +- (void)setSpeed:(NSInteger)speed; + +/** + * page 453. 选择激活部分热打印头的数量 + * Select number of parts for thermal head energizing + * + * @param number (0~4),(48~52),128 + */ +- (void)escSelectNumbersOfPartsForThermalHeadEnergizing:(NSInteger)number; + +/** + * page 456. 页模式下设置可打印区域 + * Set printable area in page mode + */ +- (void)setPageAreaWithWidth:(NSInteger)width + height:(NSInteger)height + xOffset:(NSInteger)xOffset; + +/** + * page 461. 画线 + * Draw line + * + * @param xPos (0~431) + * @param yPos (0~1199) + * @param xEnd (0~431) + * @param yEnd (0~1199) + * @param mode (1~3) + */ +- (void)appendLineWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd + mode:(NSInteger)mode; + + +/** + 画线 + Draw line + @param lineWidth 线宽 width of line + @param xPos 起点x start x + @param yPos 起点y start y + @param xEnd 终点x end x + @param yEnd 终点y end y + */ +- (void)appendLineWithLineWidth:(uint8_t)lineWidth + xPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd; + +/** + * page 465. 绘制矩形 + * Draw rectangle + * + * @param xPos (0~431) + * @param yPos (0~1199) + * @param xEnd (0~431) + * @param yEnd (0~1199) + * @param mode (1~3) + */ +- (void)appendRectWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd + mode:(NSInteger)mode; + +/** + 绘制矩形 + Draw rectangle + @param lineWidth 线宽 + @param xPos 起点x + @param yPos 起点y + @param width 宽度 + @param height 高度 + */ +- (void)appendRectangleWithLineWidth:(uint8_t)lineWidth + xPos:(NSInteger)xPos + yPos:(NSInteger)yPos + width:(NSInteger)width + height:(NSInteger)height; + +/** + * page 468. 传送打印机ID + * Transmit PrinterID + * (1,49: Printer model ID),(2,50: Type ID), (3,51: Version ID) + * + * @param id_number (1~3),(49~51) + */ +- (void)escTransmitPrinterID:(NSInteger)id_number; + +/** + * page 484. 设置水平垂直移动单位 + * Set horizontal vertical motion units + * + * @param horizontal (0~255) + * @param vertical (0~255) + */ +- (void)setMotionUnitsWithHorizontal:(NSInteger)horizontal vertical:(NSInteger)vertical; + +/** + * page 486. 初始化维护计数器 + * Initialize maintenance counter + * + * @param counter (20,21,50,70) + */ +- (void)escInitializeMaintenanceCounter:(NSInteger)counter; + +/** + * page 488. 传送维护计数器 + * Transmit maintenance counter + * + * @param counter (20,21,50,70) + */ +- (void)escTransmitMaintenanceCounter:(NSInteger)counter; + +/** + * page 493. 设置在线恢复等待时间 + * Set online recovery wait time + * + * @param wait_time1 (0~255) default 6 + * @param wait_time2 (0~255) default 0 + */ +- (void)escSetOnlineRecoveryWaitTime1:(NSInteger)wait_time1 WaitTime2:(NSInteger)wait_time2; + +#pragma mark Kanji Commands + +/** + * page 502. 选择打印日本汉字字符模式 + * Set Kanji print mode + */ +- (void)setKanjiWithReverse:(BOOL)reverse + doubleWidth:(BOOL)doubleWidth + doubleHeight:(BOOL)doubleHeight + underline:(BOOL)underline; + +/** + * page 505. 选择日本汉字字符模式 + * Set Kanji mode + */ +- (void)setKanjiMode; + +/** + * page 508. 选择日本汉字字符字体 + * Set Kanji font mode + * + * @param mode (0~2),(48~50) + */ +- (void)setKanjiFontMode:(NSInteger)mode; + +/** + * page 510. 打开/关闭日本汉字字符下划线 + * Turn on/off Kanji underline mode + * 0,48: turn off kanji underline mode + * 1,49: turn on kanji underline mode(1-dot thick) + * 2,50: turn on kanji underline mode(2-dots thick) + * + * @param underline (0~2),(48~50) + */ +- (void)setKanjiUnderline:(NSInteger)underline; + +/** + * page 512. 取消日本汉字字符模式 + * Cancel Kanji mode + */ +- (void)cancelKanjiMode; + +/** + * page 514. 定义用户定义的日本汉字字符 + * Define user-defined Kanji character + * + * @param first (119,236,254) + * @param second (33~126),(64~126),(128~158),(161~254) + */ +- (void)defineKanji:(NSData *)data first:(NSInteger)first second:(NSInteger)second; + +/** + * page 518. 选择日本汉字代码系统 + * Set Kanji code system + * 0,48 JIS code + * 1,49 SHIFT JIS code + * + * @param system (0,1),(48,49) + */ +- (void)setKanjiCodeSystem:(NSInteger)system; + +/** + * page 520. 设定日本汉字字符间距 + * Set Kanji character spacing + * @param left (0~32) default:0 + * @param right (0~32) default:0 + */ +- (void)setKanjiSpacingWithLeft:(NSInteger)left right:(NSInteger)right; + +/** + * page 522. 打开/关闭日本汉字倍高倍宽 + * Turn on/off Kanji quadruple height and width mode + * + * @param mode (0~255) + */ +- (void)setKanjiQuadrupleMode:(NSInteger)mode; + +/** + * page 523. 取消用户定义的日本汉字字符 + * Cancel user-defined Kanji character + * @param first (119,236,254) + * @param second (33~126),(64~126),(128~158),(161~254) + */ +- (void)cancelKanjiDefineWithFirst:(NSInteger)first second:(NSInteger)second; + +#pragma mark Two Dimension Code Commands + +/** + * Document 14.1 + * + * @param data data String + * @param row 0, 3 to 90 + * @param column 0 to 30 + * @param width 2 to 8 + * @param rowHeight 2 to 8 + * @param eccMode 48 to 49 + * @param eccLevel 48 to 50 + * @param option 0 to 1 + */ +- (void)appendPDF417Data:(NSString *)data + row:(NSInteger)row + column:(NSInteger)column + width:(NSInteger)width + rowHeight:(NSInteger)rowHeight + eccMode:(NSInteger)eccMode + eccLevel:(NSInteger)eccLevel + option:(NSInteger)option; + +/** + * page 549. 传输符号存储区中符号数据的大小信息 + * Transmit PDF417 symbol data size in symbol storage area + */ +- (void)transmitPDF417SymbolDataSize; + +/// QRCode +/// @param data 二维码数据 +/// @param justification 对齐方式 取值0,1,2 : 左、中、右 +/// @param leftMargin 左间距 +/// @param eccLevel 纠错等级,取值48~51: Level L,M,Q,H +/// @param model 二维码样式,取值49,50 : 两种样式 +/// @param size 大小,取值1~16 +- (void)appendQRCodeData:(NSString *)data + justification:(NSInteger)justification + leftMargin:(NSInteger)leftMargin + eccLevel:(NSInteger)eccLevel + model:(NSInteger)model + size:(NSInteger)size; + +/** + * page 562. 二维码:传输符号存储区中的符号数据的大小信息 + * QR code: transmit QR code symbol data size in symbol storage area + */ +- (void)transmitQRCodeSymbolDataSize; + +/** + * Document 14.3 + * + * @param data maxicode数据 + */ +- (void)appendMaxiCodeData:(NSString *)data mode:(NSInteger)mode; + +/** + * page 570. 传输符号存储区中的符号数据大小信息 + * Transmit maxi code symbol data size in symbol storage area + */ +- (void)transmitMaxiCodeSymbolDataSize; + +/** + * Document 14.4 + * + * @param data RSS-2D data + * @param mode 72,73,76 + * @param moduleWidth 2 to 8 + * @param maxWidth 2 to 8 + */ +- (void)appendRSS2Data:(NSData *)data + mode:(NSInteger)mode + moduleWidth:(NSInteger)moduleWidth + maxWidth:(NSInteger)maxWidth; + +/** + * page 579. 传输符号存储区中符号数据的大小信息 + * Transmit RSS2 symbol data size in symbol storage area + */ +- (void)transmitRSS2SymbolDataSize; + +/** + * Document 14.5 + * + * @param data composite symbol data + * @param mode 48 to 49 + * @param type 65 to 77 + * @param moduleWidth 2 to 8 + * @param maxWidth 2 to 8 + * @param hriFont 0 to 3, 48 to 51 + */ +- (void)appendCompositeSymbolData:(NSData *)data + mode:(NSInteger)mode + type:(NSInteger)type + moduleWidth:(NSInteger)moduleWidth + maxWidth:(NSInteger)maxWidth + hriFont:(NSInteger)hriFont; + +/** + * page 600. 传输符号存储区中的符号数据的大小信息 + * Transmit composite symbol data size in symbol storage area + */ +- (void)transmitCompositeSymbolDataSize; + +#pragma mark Customize Commands + +/** + * page 606. 写入NV用户内存 + * Write NV user memory + * @param address (0~1023) + */ +- (void)writeNVUserMemory:(NSInteger)address data:(NSData *)data; + +/** + * page 608. 读取NV用户内存 + * Read NV user memory + * @param address (0~1023) + */ +- (void)readNVUserMemory:(NSInteger)address length:(NSInteger)length; + +/** + * page 615. 删除指定记录数据 + * Delete specified record data + * + * @param mode (0,48) + * @param key (32~126) + * @param key2 (32~126) + */ +- (void)deleteRecordWithMode:(NSInteger)mode key:(NSInteger)key key2:(NSInteger)key2; + +/** + * page 616. 存储指定记录数据 + * Store specified record data + * + * @param mode (0,48) + * @param key (32~126) + * @param key2 (32~126) + */ +- (void)storeRecordWithMode:(NSInteger)mode key:(NSInteger)key key2:(NSInteger)key2 data:(NSData *)data; + +/** + * page 618. 传输指定记录数据 + * Transmit specified record data + * + * @param mode (0,48) + * @param key (32~126) + * @param key2 (32~126) + */ +- (void)transmitDataInRecordWithMode:(NSInteger)mode key:(NSInteger)key key2:(NSInteger)key2; + +/** + * page 620. 传输当前NV用户已使用内存容量 + * Transmit current used capacity of NV memory + * + * @param mode 3,51 + */ +- (void)transmitNVMemoryUsedCapacityWithMode:(NSInteger)mode; + +/** + * page 621. 传输NV用户内存剩余容量 + * Transmit remaining capacity of NV memory + * + * @param mode 4,52 + */ +- (void)transmitNVMemoryRemainingCapacityWithMode:(NSInteger)mode; + +/** + * page 622. 传输键控代码列表 + * Transmit key code list + * + * @param mode 5,53 + */ +- (void)transmitKeyCodeListWithMode:(NSInteger)mode; + +/** + * page 624. 删除所有NV用户内存 + * Delete all the NV memory + * + * @param mode 6,54 + */ +- (void)deleteNVMemoryAllWithMode:(NSInteger)mode; + +/** + * page 631. 变换用户设置模式 + * Change user setting mode + */ +- (void)changeUserSettingMode; + +/** + * page 632. 结束用户设置模式会话 + * End user setting mode + */ +- (void)endUserSettingMode; + +/** + * page 633. 更改内存开关 + * Change memory switch + * + * @param data (0~255) + */ +- (void)escChangeMemorySwitchData:(NSData *)data; + +/** + * page 646. 传输内存开关设置 + * Transmit memory switch setting + * + * @param a (1,2,8) + */ +- (void)escTransmitMemorySwitchSettingA:(NSInteger)a; + +/** + * page 648. 设定自定义设置值 + * Set customized setting values + */ +- (void)escSetCustomizedSettingValuesData:(NSData *)data; + +/** + * page 663. 传输自定义设置值 + * Transmit customized setting values + * + * @param a (5,6,97,116,118) + */ +- (void)escTransmitCustomizedSettingValuesA:(NSInteger)a; + +/** + * page 666. 复制用户定义页面 + * Copy user-defined page + * + * @param font_number (10,12,17,18) + * @param d1 (30,31) + * @param d2 (30,31) d1 can't be euqual o d2!! + */ +- (void)escCopyUserDefinedPageWithFontNumber:(NSInteger)font_number D1:(NSInteger)d1 D2:(NSInteger)d2; + +/** + * page 669. 定义字符代码页数据(列格式) + * Define data for character code page (column format) + * + * @param c1 (128~255) + * @param c2 (128~255) + */ +- (void)escDefineColumnFormatDataForCharacterCodePageY:(NSInteger)y C1:(NSInteger)c1 C2:(NSInteger)c2 Data:(NSData *)data; + +/** + * page 671. 定义字符代码页数据(行格式) + * Define data for character code page (raster format) + * + * @param c1 (128~255) + * @param c2 (128~255) + */ +- (void)escDefineRasterFormatDataForCharacterrCodePageX:(NSInteger)x C1:(NSInteger)c1 C2:(NSInteger)c2 Data:(NSData *)data; + +/** + * page 673. 删除字符代码页数据 + * Delete data for character code page + * + * @param c1 (128~255) + * @param c2 (128~255) + */ +- (void)escDeleteDataForChracterCodePageC1:(NSInteger)c1 C2:(NSInteger)c2; + +/** + * page 674. 设置串行接口配置项 + * Set configuration item for serial interface + * + * @param a (1~4),depend on data + */ +- (void)escSetConfigurationItemForSerialInterfaceA:(NSInteger)a Data:(NSData *)data; + +/** + * page 678. 传输串行接口配置项 + * Transmit configuration item for serial interface + * + * @param pl (2) + * @param ph (0) + * @param a (1~4) + */ +- (void)escTransmitConfigurationItemForSerialInterfacePL:(NSInteger)pl PH:(NSInteger)ph A:(NSInteger)a; + +/** + * page 680. 设置蓝牙接口配置项 + * Set configuration item for Bluetooth interface + * @param a (49,65) + */ +- (void)escSetConfigurationItemForBluetoothInterfaceA:(NSInteger)a Data:(NSData *)data; + +/** + * page 682. 传输设置蓝牙接口配置项 + * Transmit configuration item for Bluetooth interface + * + * @param a (48,49,65) + */ +- (void)escTransmitConfigurationItemForBluetoothInterfaceA:(NSInteger)a; + +/** + * page 685. 删除页面布局 + * Delete paper layout + */ +- (void)escDeletePaperLayout; + +/** + * page 686. 设置页面布局 + * Set paper layout + * @param p (9~36) + * @param sa (48,49,64) + * @param sb (135~3000) + * @param sc (25~100) + * @param sd (0~3000) + * @param se (0~3000) + * @param sf (38~3000) + * @param sg (when sa = '48' or '49':27~507),(when sa = '64':47~507) + * @param sh (when sa = '48' or '49':240~720),(when sa = '64':240~700) + */ +- (void)escSetPaperLayoutP:(NSInteger)p SA:(NSInteger)sa SB:(NSInteger)sb SC:(NSInteger)sc + SD:(NSInteger)sd SE:(NSInteger)se SF:(NSInteger)sf SG:(NSInteger)sg SH:(NSInteger)sh; + +/** + * page 692. 传输页面布局信息 + * Transmit paper layout information + * + * @param n 64,80 + */ +- (void)escTransmitPaperLayoutInformation:(NSInteger)n; + +/** + * page 701. 工作区域设置值保存到存储区域 + * Save setting values from work area into storage area + * + * @param fn (1,49) + * @param m (1,49) + */ +- (void)escSaveSettingValuesFromWorkAreaIntoStorageAreaFN:(NSInteger)fn M:(NSInteger)m; + +/** + * page 702. 加载存储区域已保存的设定值到工作区域 + * Load setting values stored in storage area to work area + * + * @param fn (2,50) + * @param m (0,1,48,49) + */ +- (void)escLoadSettingValuesStoredInStorageAreaToWorkAreaFN:(NSInteger)fn M:(NSInteger)m; + +/** + * page 703. 初始化过程后选择设置值加载到工作区域 + * Select setting values loaded to work area after initialization process + * + * @param fn (3,51) + * @param m (0,1,48,49) + */ +- (void)escSelectSettingValuesLoadedToWorkAreaAfterInitializationProcessFN:(NSInteger)fn M:(NSInteger)m; + +#pragma mark Counter Printing Commands + +/** + * page 705. 选择计数器打印模式 + * Select counter print mode + * + * @param digits (2~5) + * @param justification (0~2),(48~50) + */ +- (void)escSelectCounterPrintModeWithDigits:(NSInteger)digits Justification:(NSInteger)justification; + +/** + * page 707. 选择计数模式 + * Select counter mode + * + * @param counting_mode (0~65535) + * @param repetition (0~65535) + */ +- (void)escSelectCounterModeA_MinimumValue:(NSInteger)minimum_value + MaximumValue:(NSInteger)maximum_value + CountingMode:(NSInteger)counting_mode + Repetition:(NSInteger)repetition; + +/** + * page 709. 设定计数器 + * Set counter + * + * @param counter (0~65535) default:1 + */ +- (void)escSetCounter:(NSInteger)counter; + +/** + * page 710. 选择计数器模式 + * Select counter mode + * + * @param sa (0~65535) default:1 + * @param sb (0~65535) default:65535 + * @param sn (0~255) default:1 + * @param sr (0~255) default:1 + * @param sc (0~65535) default:1 + */ +- (void)escSelectCounterModeB_SA:(NSInteger)sa SB:(NSInteger)sb SN:(NSInteger)sn SR:(NSInteger)sr SC:(NSInteger)sc; + +/** + * page 713. 打印计数器 + * Print counter + */ +- (void)escPrintCounter; + +#pragma mark Printing Paper Commands + +/** + * page 720. 纸张布局设置 + * Paper layout setting + * + * @param p (8~26) + * @param sm (0~3) mode + * @param sa (0),(284~1550) + * @param sb (-150,-1500) + * @param sc (-290,-50) + * @param sd (0,-15) + * @param se (-15,-15) + * @param sf (290,-600) + */ +- (void)escPaperLayoutSettingP:(NSInteger)p SM:(NSInteger)sm SA:(NSInteger)sa + SB:(NSInteger)sb SC:(NSInteger)sc SD:(NSInteger)sd SE:(NSInteger)se SF:(NSInteger)sf; + +/** + * page 729. 传递纸张布局设置 + * Transmit paper layout setting information + * + * @param n (64,80) + */ +- (void)escPaperLayoutInformationTransmissionN:(NSInteger)n; + +/** + * page 732. 传输当前位置信息 + * Transmit current positioning information + * + * @param m 48 + */ +- (void)escTransmitPositioningInformationM:(NSInteger)m; + +/** + * pag 737. 从标签脱离位置走纸 + * Feed paper to label peeling position + * + * @param m (48,49) + */ +- (void)escFeedPaperToLabelPeelingPositionM:(NSInteger)m; + +/** + * page 740. 从剪纸位置走纸 + * Feed paper to cutting position + * + * @param m (48,49) + */ +- (void)escFeedPaperToCuttingPositionM:(NSInteger)m; + +/** + * page 742. 从打印开始位置走纸 + * Feed paper to print starting position + * + * @param m (48,49,50) + */ +- (void)escFeedPaperToPrintStartingPositionM:(NSInteger)m; + +/** + * page 744. 纸张布局误差设置 + * Paper layout error special margin setting + * + * @param p (2,3) + * @param sn (80) + */ +- (void)escPaperLayoutErrorSpecialMarginSettingP:(NSInteger)p SN:(NSInteger)sn; + + +@end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTCommandTSPL.h b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandTSPL.h new file mode 100644 index 0000000..6f510b0 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandTSPL.h @@ -0,0 +1,1544 @@ +/*! + * \~chinese + * @header PTCommandTSPL.h + * @abstract TSPL指令 + * + * \~english + * @header PTCommandTSPL.h + * @abstract TSPL Command + */ + +#import +#import "SDKDefine.h" +#import "PTBitmap.h" + +/*! + * \~chinese + * 打印速度 + * + * \~english + * Print speed + */ +typedef NS_ENUM(NSUInteger, PTTSCPrintSpeed) { + PTTSCPrintSpeed1 = 1, + PTTSCPrintSpeed2 = 2, + PTTSCPrintSpeed3 = 3, + PTTSCPrintSpeed4 = 4, + PTTSCPrintSpeed5 = 5, + PTTSCPrintSpeed6 = 6, + PTTSCPrintSpeed10 = 10, + PTTSCPrintSpeed12 = 12 +}; + +/*! + * \~chinese + * 打印浓度 + * + * \~english + * Print density + */ +typedef NS_ENUM(NSUInteger, PTTSCPrintDensity) { + PTTSCPrintDensity0 = 0, + PTTSCPrintDensity1 = 1, + PTTSCPrintDensity2 = 2, + PTTSCPrintDensity3 = 3, + PTTSCPrintDensity4 = 4, + PTTSCPrintDensity5 = 5, + PTTSCPrintDensity6 = 6, ///< default + PTTSCPrintDensity7 = 7, + PTTSCPrintDensity8 = 8, + PTTSCPrintDensity9 = 9, + PTTSCPrintDensity10 = 10, + PTTSCPrintDensity11 = 11, + PTTSCPrintDensity12 = 12, + PTTSCPrintDensity13 = 13, + PTTSCPrintDensity14 = 14, + PTTSCPrintDensity15 = 15 +}; + +/*! + * \~chinese + * 打印方向 + * + * \~english + * DIRECTION + */ +typedef NS_ENUM(NSUInteger, PTTSCPrintDirection) { + + /*! \~chinese 正常方向 \~english normal */ + PTTSCPrintDirectionNormal = 0, + + /*! \~chinese 反向 \~english Reverse */ + PTTSCPrintDirectionReverse = 1 +}; + +/*! + * \~chinese + * 打印模式 + * + * \~english + * Print Mode + */ +typedef NS_ENUM(NSUInteger, PTTSCPrintStyle) { + + /*! \~chinese 正常模式 \~english normal */ + PTTSCPrintStyleNormal = 0, + /*! \~chinese 镜像模式 \~english Mirror */ + PTTSCPrintStyleMirror = 1 +}; + +/*! + * \~chinese + * 国际字符集类型 + * + * \~english + * International character + */ +typedef NS_ENUM(NSUInteger, PTTSCCharacterStyle) { + PTTSCCharacterStyleUSA = 0, + PTTSCCharacterStyleBritish, + PTTSCCharacterStyleGerman, + PTTSCCharacterStyleFrench, + PTTSCCharacterStyleDanish, + PTTSCCharacterStyleItalian, + PTTSCCharacterStyleSpanish, + PTTSCCharacterStyleSwedish, + PTTSCCharacterStyleSwiss, + PTTSCCharacterStyleUnitedStates, + PTTSCCharacterStyleMultilingual, + PTTSCCharacterStyleSlavic, + PTTSCCharacterStylePortuguese, + PTTSCCharacterStyleCanadianOrFrench, + PTTSCCharacterStyleNordic, + PTTSCCharacterStyleTurkish, + PTTSCCharacterStyleWindowsCentralEurope, + PTTSCCharacterStyleWindowsLatin, + PTTSCCharacterStyleWindowsGreek, + PTTSCCharacterStyleWindowsTurkish +}; + +/*! + * \~chinese + * 一维条码类型 + * + * \~english + * Barcode type + */ +typedef NS_ENUM(NSUInteger, PTTSCBarcodeStyle) { + PTTSCBarcodeStyle128 = 0, + PTTSCBarcodeStyle128M, + PTTSCBarcodeStyleEAN128, + PTTSCBarcodeStyle25, + PTTSCBarcodeStyle25C, + PTTSCBarcodeStyle39, + PTTSCBarcodeStyle39C, + PTTSCBarcodeStyle93, + PTTSCBarcodeStyleEAN13, + PTTSCBarcodeStyleEAN132, + PTTSCBarcodeStyleEAN135, + PTTSCBarcodeStyleEAN8, + PTTSCBarcodeStyleEAN82, + PTTSCBarcodeStyleEAN85, + PTTSCBarcodeStyleCODA, + PTTSCBarcodeStylePOST, + PTTSCBarcodeStyleUPCA, + PTTSCBarcodeStyleUPCA2, + PTTSCBarcodeStyleUPCA5, + PTTSCBarcodeStyleUPCE, + PTTSCBarcodeStyleUPCE2, + PTTSCBarcodeStyleUPCE5, + PTTSCBarcodeStyleCPOST, + PTTSCBarcodeStyleMSI, + PTTSCBarcodeStyleMSIC, + PTTSCBarcodeStylePLESSY, + PTTSCBarcodeStyleITF14, + PTTSCBarcodeStyleEAN14, + PTTSCBarcodeStyle11 +}; + +/*! + * \~chinese + * 是否可识别 + * + * \~english + * Readable + */ +typedef NS_ENUM(NSUInteger, PTTSCBarcodeReadbleStyle) { + + /*! \~chinese 不可识别 \~english not */ + PTTSCBarcodeReadbleStyleNot = 0, + + /*! \~chinese 可识别 \~english human */ + PTTSCBarcodeReadbleStyleHuman +}; + +/*! + * \~chinese + * 旋转角度 + * + * \~english + * Rotation + */ +typedef NS_ENUM(NSUInteger, PTTSCStyleRotation) { + + /*! \~chinese 正常打印 \~english normal */ + PTTSCStyleRotation0 = 0, + /*! \~chinese 顺时针旋转90度 \~english rotate 90 degrees (clockwise) */ + PTTSCStyleRotation90 = 90, + /*! \~chinese 180度旋转 \~english inverted 180 degrees */ + PTTSCStyleRotation180 = 180, + /*! \~chinese 270度旋转 \~english read from bottom up, 270 degrees */ + PTTSCStyleRotation270 = 270 +}; + +/*! + * \~chinese + * 条码宽窄条比例 + * + * \~english + * The ratio of wide to narrow bars + */ +typedef NS_ENUM(NSUInteger, PTTSCBarcodeRatio) { + PTTSCBarcodeRatio1 = 1, ///< 1:1 + PTTSCBarcodeRatio2, ///< 1:2 + PTTSCBarcodeRatio3, ///< 1:3 + PTTSCBarcodeRatio4, ///< 2:5 + PTTSCBarcodeRatio5 ///< 3:7 +}; + +/*! + * \~chinese + * 二维码纠错等级 + * + * \~english + * Error correction recovery level + */ +typedef NS_ENUM(UInt8, PTTSCQRcodeEcclevel) { + + /*! \~chinese ⾼密度级别 \~english high density level level */ + PTTSCQRcodeEcclevelL = 'L', + + /*! \~chinese 标准级别 \~english standard level */ + PTTSCQRcodeEcclevelM = 'M', + + /*! \~chinese 高可靠级别 \~english high reliability level */ + PTTSCQRcodeEcclevelQ = 'Q', + + /*! \~chinese 极高可靠级别 \~english ultra-high reliability level */ + PTTSCQRcodeEcclevelH = 'H' +}; + +/*! + * \~chinese + * 二维码大小 + * + * \~english + * cell width + */ +typedef NS_ENUM(NSUInteger, PTTSCQRcodeWidth) { + PTTSCQRcodeWidth1 = 1, + PTTSCQRcodeWidth2, + PTTSCQRcodeWidth3, + PTTSCQRcodeWidth4, + PTTSCQRcodeWidth5, + PTTSCQRcodeWidth6, + PTTSCQRcodeWidth7, + PTTSCQRcodeWidth8, + PTTSCQRcodeWidth9, + PTTSCQRcodeWidth10 +}; + +/*! + * \~chinese + * 二维码模式 + * + * \~english + * qrcode mode + */ +typedef NS_ENUM(UInt8, PTTSCQRCodeMode) { + /*! \~chinese 自动 \~english auto */ + PTTSCQRCodeModeAuto = 'A', + + /*! \~chinese 手动 \~english Manual */ + PTTSCQRCodeModeManual = 'M' +}; + +/*! + * \~chinese + * 二维码模型 + * + * \~english + * qrcode model + */ +typedef NS_ENUM(NSUInteger, PTTSCQRCodeModel) { + + /*! \~chinese 默认值,原始版本 \~english (default), original version */ + PTTSCQRCodeModelM1 = 0, + + /*! \~chinese 增强版本 \~english enhanced version */ + PTTSCQRCodeModelM2 = 1 +}; + +/*! + * \~chinese + * 二维码mask + * + * \~english + * qrcode mask + */ +typedef NS_ENUM(NSUInteger, PTTSCQRcodeMask) { + PTTSCQRcodeMaskS0 = 1, + PTTSCQRcodeMaskS1, + PTTSCQRcodeMaskS2, + PTTSCQRcodeMaskS3, + PTTSCQRcodeMaskS4, + PTTSCQRcodeMaskS5, + PTTSCQRcodeMaskS6, + PTTSCQRcodeMaskS7, + PTTSCQRcodeMaskS8 +}; + +/*! + * \~chinese + * 位图模式 + * + * \~english + * qrcode mask + */ +typedef NS_ENUM(NSUInteger, PTTSCBitmapMode) { + + PTTSCBitmapModeOVERWRITE = 0, + PTTSCBitmapModeOR = 1, + PTTSCBitmapModeXOR = 2, + + /*! *\~chinese 压缩模式,兼容旧的固件,新的固件已经废弃 *\~english Compatible with old models,New firmware has been deprecated */ + PTTSCBitmapModeCompress = 3, + PTTSCBitmapModeOVERWRITECompress = 16, + PTTSCBitmapModeORCompress = 17, + PTTSCBitmapModeXORCompress = 18 +}; + + +/*! + * \~chinese + * 文本字体类型(含有矢量字库的机型),中文只能选9 + * + * \~english + * Text font type,for vector and ,chinese onlt select 9 + */ +typedef NS_ENUM(NSUInteger, PTTSCTextVectorFontStyle) { + + PTTSCTextVectorFontStyle0 = 0, ///< 8x12,not adjuset + PTTSCTextVectorFontStyle1, ///< 8x12 + PTTSCTextVectorFontStyle2, ///< 12x20 + PTTSCTextVectorFontStyle3, ///< 16x24 + PTTSCTextVectorFontStyle4, ///< 24x32 + PTTSCTextVectorFontStyle5, ///< 32x48 + PTTSCTextVectorFontStyle6, ///< 14x19 + PTTSCTextVectorFontStyle7, ///< 21x27 + PTTSCTextVectorFontStyle8, ///< 14x25 + PTTSCTextVectorFontStyle9 ///< vector font,for chinese +}; + +/*! + * \~chinese + * 文本字体类型,支持中英文 + * + * \~english + * Text font type,Support Chinese and English + */ +typedef NS_ENUM(NSUInteger, PTTSCTextFontStyle) { + PTTSCTextFontStyle0 = 0, ///< chinese:24x24 english:12x24 + PTTSCTextFontStyle1, ///< chinese:16x16 english:8x16 +}; + +/*! + * \~chinese + * DMATRIX二维码的模块尺寸 + * + * \~english + * Module size for DMATRIX 2D bar code + */ +typedef NS_ENUM(UInt8, PTTSCDMATRIXSize) { + PTTSCDMATRIXSizeX6 = 0, + PTTSCDMATRIXSizeX8 +}; + + +@interface PTCommandTSPL : NSObject + +/*! + * \~chinese + * + * 下发给打印机的数据. + * + * \~english + * + * Data sent to the printer. + * + */ +@property(strong,nonatomic,readwrite) NSMutableData *cmdData; + +/*! + * \~chinese + * + * 指令使用的编码,默认是GBK. + * + * \~english + * + * encode,default is GBK. + * + */ +@property (nonatomic, assign) NSStringEncoding encoding; + + +///////////////////////////////////////////////////////////////////// +/********************* Setup and System Commands ********************/ +///////////////////////////////////////////////////////////////////// +/*! + * \~chinese + * + * 自检,打印打印机信息. + * + * @brief 打印自检页 + * + * \~english + * + * printer Print self-test message. + * + * @brief View Printer Message + */ +- (void)selfTest; + +/*! + * \~chinese + * + * 添加指令. + * + * @brief 拼接指令 + * @param cmd 指令文本.使用encoding属性进行编码. + * + * \~english + * + * append command. + * + * @brief Append Command + * @param cmd command text. encode with encoding property. + * + */ +- (void)appendCommand:(NSString *)cmd; + +/*! + * \~chinese + * + * 设置打印纸张范围大小,传的是毫米.1mm == 8 dot + * + * @brief 设置打印区域 + * @param label_width 标签纸的宽度 + * @param label_height 标签纸的高度 + * + * \~english + * + * This command defines the label width and length(mm).1mm == 8 dot + * + * @brief Set Print Area + * @param label_width Label width + * @param label_height Label length + * + */ +- (void)setPrintAreaSizeWithWidth:(NSInteger)label_width + height:(NSInteger)label_height; + +/*! + * \~chinese + * + * 设置标签纸的间距,传的是毫米. + * + * @brief 设置标签纸的间距 + * @param distance 两张标签紙中间的垂直距离,0 ≤ distance ≤ 25.4 (mm) + * @param offset 垂直间距的偏移 + * + * \~english + * + * This command sets the distance between two labels(mm). + * + * @brief Set Label Distance + * @param distance The gap distance between two labels,0 ≤ distance ≤ 25.4 (mm) + * @param offset The offset distance of the gap offset ≤ label length (mm) + * + */ +- (void)setGapWithDistance:(NSInteger)distance + offset:(NSInteger)offset; + +/*! + * \~chinese + * + * 设置黑线的高度和用户自定义的额外的标签进纸长度(毫米).(height,offset 为0,0表示连续标签) + * + * @brief 设置进纸长度 + * @param height 黑线的高度 0~25.4 mm + * @param offset 黑线偏移量 0~label length + * + * \~english + * + * This command sets the height of the black line and the user-defined extra label feeding length each form feed takes(mm).(height,offset is 0,0 : Continuous label) + * + * @brief Bline + * @param height The height of black line either in mm. 0 ≤ m ≤ 25.4 (mm) + * @param offset The extra label feeding length. 0 ≤ offset ≤ label length + * + */ +- (void)setBlineWithHeight:(NSInteger)height + offset:(NSInteger)offset; + +/*! + * \~chinese + * + * 设置打印机定位完后再走纸多少毫米. + * + * @brief 定位后走纸 + * @param distance 纸张走纸的距离,0 ≤ distance ≤ 25.4 (mm) + * + * \~english + * + * This command defines the selective, extra label feeding length(mm). + * + * @brief Offset Length + * @param distance The offset distance,0 ≤ distance ≤ 25.4 (mm) + * + */ +- (void)setOffsetWithDistance:(NSInteger)distance; + +/*! + * \~chinese + * + * 将标签定位到下一个标签的起始处. + * + * @brief 定位 + * \~english + * + * This command feeds label to the beginning of next label. + * + * @brief Form Feed + */ +- (void)feedToNextLabel; + +/*! + * \~chinese + * + * 设置标签进纸的长度(dots). + * + * @brief 设置标签进纸的长度 + * @param length 纸张走纸的距离,1 ≤ length ≤ 9999 + * + * \~english + * + * This command feeds label with the specified length. + * + * @brief Feed Length + * @param length The length is specified by dot. 1 ≤ length ≤ 9999 + * + */ +- (void)setFeedLength:(NSInteger)length; + +/*! + * \~chinese + * + * 设置打印速度. + * + * @brief 设置打印速度 + * @param speed 打印速度 + * + * \~english + * + * This command defines the print speed. + * + * @brief Print Speed + * @param speed Printing speed in inch per second + * + */ +- (void)setPrintSpeed:(PTTSCPrintSpeed)speed; + +/*! + * \~chinese + * + * 设置打印浓度. + * + * @brief 设置打印浓度 + * @param density 打印浓度 + * + * \~english + * + * This command sets the printing darkness. + * + * @brief Print Density + * @param density 0: specifies the lightest level,15: specifies the darkest level + * + */ +- (void)setPrintDensity:(PTTSCPrintDensity)density; + +/*! + * \~chinese + * + * 设置打印的方向和镜像. + * + * @brief 设置打印的方向和镜像 + * @param direction 正常或者方向打印 + * @param mirror 正常或者镜像 + * + * \~english + * + * This command defines the printout direction and mirror image. + * + * @brief Print Direction And Mirror + * @param direction normal or reverse + * @param mirror normal or mirror + * + */ +- (void)setPrintDirection:(PTTSCPrintDirection)direction mirror:(PTTSCPrintStyle)mirror; + +/*! + * \~chinese + * + * 设置标签的参考起点. + * + * @brief 设置标签的参考起点 + * @param x_pos 水平方向的坐标,以点为单位 + * @param y_pos 垂直方向的坐标,以点为单位 + * + * \~english + * + * This command defines the reference point of the label. + * + * @brief Set Label Reference Point + * @param x_pos Horizontal coordinate (in dots) + * @param y_pos Vertical coordinate (in dots) + * + */ +- (void)setReferenceXPos:(NSInteger)x_pos + yPos:(NSInteger)y_pos; + +/*! + * \~chinese + * + * 设置国际字符集代码. + * + * @brief 设置国际字符集代码 + * @param codepage 字符集类型 + * + * \~english + * + * This command defines the code page of international character set. + * + * @brief International Character Set + * @param codepage Name or number of code page + * + */ +- (void)setCodePage:(PTTSCCharacterStyle)codepage; + +/*! + * \~chinese + * + * 清除图像缓冲区. + * + * @brief 清除图像缓冲区 + * \~english + * + * This command clears the image buffer. + * + * @brief Clear Buffer + */ +- (void)setCLS; + +/*! + * \~chinese + * + * 回纸. + * + * @brief 回纸 + * @param distance 回纸的距离,以点为单位(1,9999) + * + * \~english + * + * This command feeds the label in reverse. The length is specified by dot. + * + * @brief Feeds Label In Reverse + * @param distance unit: dot,(1,9999) + * + */ +- (void)setBackFeed:(NSInteger)distance; + +/*! + * \~chinese + * + * 回纸. + * + * @brief 回纸 + * @param distance 回纸的距离,以点为单位(1,9999) + * + * \~english + * + * This command feeds the label in reverse. The length is specified by dot. + * + * @brief Feeds Label In Reverse + * @param distance unit: dot,(1,9999) + * + */ +- (void)setBackUP:(NSInteger)distance; + +/*! + * \~chinese + * + * 设置标签定位到内部传感器确定的起点. + * + * @brief 设置标签定位起点 + * \~english + * + * This command will feed label until the internal sensor has determined the origin. + * + * @brief Feed label until the internal sensor has determined the origin + */ +- (void)setHome; + +/*! + * \~chinese + * + * 打印数量. + * + * @brief 开始打印,设置打印数量 + * @param sets 打印份数 + * @param copies 每份打印的张数 + * + * \~english + * + * This command prints the label format currently stored in the image buffer. + * + * @brief Begin Print,Set Print Copies + * @param sets Specifies how many sets of labels will be printed. + * @param copies Specifies how many copies should be printed for each particular label set. + * + */ +- (void)printWithSets:(NSInteger)sets copies:(NSInteger)copies; + +/*! + * \~chinese + * + * 控制蜂鸣器的频率,可设置10阶的声音. + * + * @brief 控制蜂鸣器的频率 + * @param level 音阶0~9 + * @param interval 时间长度1~4095 + * + * \~english + * + * This command controls the sound frequency of the beeper. There are 10 levels of sounds. + * + * @brief Control Frequency + * @param level Sound level: 0~9 + * @param interval Sound interval: 1~4095 + * + */ +- (void)setSoundWithLevel:(NSInteger)level interval:(NSInteger)interval; + +/*! + * \~chinese + * + * 设置切纸. + * @brief 设置切纸 + * + * \~english + * + * This command activates the cutter to immediately cut the labels without back feeding the label. + * + * @brief Set Cutter + */ +- (void)setCut; + +/*! + * \~chinese + * + * 设置打印机进纸时,若无法正确的间隙位置,则会发生错误,立即停止进纸. + * + * @brief 设置进纸长度 + * @param max_len 传感器检测的最大长度 + * + * \~english + * + * If the gap sensor is not set to a suitable sensitivity while feeding labels, the printer will not be able to locate the correct position of the gap. + * + * @brief Set Feed Length + * @param max_len The maximum length for sensor detecting. + * + */ +- (void)setLimitFeed:(NSInteger)max_len; + +/*! + * \~chinese + * + * 设置字体加粗. + * + * @brief 设置字体加粗 + * @param bold true:加粗 false:不加粗 + * + * \~english + * + * Set font bold. + * + * @brief Font Bold + * @param bold true:bold false:not bold + * + */ +- (void)setFontBold:(BOOL)bold; + +/*! + * \~chinese + * + * 开关打印状态回调. + * + * @brief 自动回传状态 + * @note 开启之后,每打印一张都会返回10个字节的数据,格式:指令头4个字节(aa bb cc dd) + 4个字节的打印张数(从开启到关闭的打印总张数) + 1个字节的状态 + 结束符00, + 返回两次数据,第一次表示返回可获取打印总张数和状态,第二次表示打印结束 + 比如:1.aabbccdd 03000000 2000 + 2.aabbccdd ffffffff 0000 -> 打印结束 + aabbccdd 00000000 0000 -> 关闭自动回传 + * @param status true:开启 false:关闭 + * + * \~english + * + * Turn on/off print status callback. + * + * @brief Automatic Return Status + * @note Returns 10 bytes of data,4-byte instruction header(aa bb cc dd) + 4 bytes of printed sheets + 1 byte status + Terminator(00),Returns twice the data, the first time to return to get the total number of prints and the status, the second time to end the end of printing + + * @param status true:open false:close + * + */ +- (void)setPrinterStateAutomaticBackWithStatus:(BOOL)status; + +/*! + * \~chinese + * + * 获取打印机状态. + * + * @brief 获取打印机状态 + * + | 位(返回值) | 状态 | + | --------- | ----------- | + | 0 | 开盖 | + | 1 | 卡纸 | + | 2 | 缺纸 | + | 3 | 无碳带 | + | 4 | 暂停 | + | 5 | 打印中 | + | 6 | 开盖 | + | 7 | 高温 | + * + * \~english + * + * Get print status. + * @brief Get Print Status + * + | Bit(return value) | Status | + | ----------------- | ------------- | + | 0 | Head opened | + | 1 | Paper jam | + | 2 | Out of paper | + | 3 | Out of ribbon | + | 4 | Pause | + | 5 | Printing | + | 6 | Cover opened | + | 7 | High | + * + */ +- (void)getPrinterStatus; + + +///////////////////////////////////////////////////////////////////// +/********************* Label Commands ********************/ +///////////////////////////////////////////////////////////////////// + +/*! + * \~chinese + * + * 在标签上画一条线. + * + * @brief 画线 + * @param x_pos 左上角水平方向起始点,以点表示 + * @param y_pos 左上角垂直方向起始点,以点表示 + * @param width 线宽,以点表示 + * @param height 线高,以点表示 + * + * \~english + * + * This command draws a bar on the label format. + * + * @brief Draws Bar + * @param x_pos The upper left corner x-coordinate (in dots) + * @param y_pos The upper left corner y-coordinate (in dots) + * @param width Bar width (in dots) + * @param height Bar height (in dots) + * + */ +- (void)drawBarWithXPos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + width:(NSInteger)width + height:(NSInteger)height; + +/*! + * \~chinese + * + * 打印一维条码. + * + * @brief 打印一维条码 + * @param x_pos 指定标签上条形码的x坐标 + * @param y_pos 指定标签上条形码的y坐标 + * @param type 条码类型 + * @param height 条码高度 + * @param readable 是否可读:0,不可读,1,可读 + * @param rotation 旋转角度 + * @param ratio 条码宽窄条比例 + * @param context 条码内容 + * + * \~english + * + * This command prints 1D barcodes. + * + * @brief 1D Barcodes + * @param x_pos Specify the x-coordinate of the bar code on the label + * @param y_pos Specify the y-coordinate of the bar code on the label + * @param type code type + * @param height Bar code height (in dots) + * @param readable 0: not readable 1: human readable + * @param rotation Rotation + * @param ratio The ratio of wide to narrow bars + * @param context The maximum number of digits of bar code content + * + */ +- (void)printBarcodeWithXPos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + type:(PTTSCBarcodeStyle)type + height:(NSInteger)height + readable:(PTTSCBarcodeReadbleStyle)readable + rotation:(PTTSCStyleRotation)rotation + ratio:(PTTSCBarcodeRatio)ratio + context:(NSString *)context; + +/*! + * \~chinese + * + * 打印二维条码. + * + * @brief 打印二维条码 + * @param x_pos 指定标签上二维码的x坐标 + * @param y_pos 指定标签上二维码的y坐标 + * @param ecc_level 纠错等级 + * @param width 二维码大小 + * @param mode 二维码模式 + * @param rotation 旋转角度 + * @param model 二维码模型 + * @param mask 二维码mask + * @param context 二维码内容 + * + * \~english + * + * This command prints QR code. + * + * @brief QR Code + * @param x_pos Specify the x-coordinate of the qr code on the label + * @param y_pos Specify the y-coordinate of the qr code on the label + * @param ecc_level Error correction recovery level + * @param width cell width + * @param mode mode + * @param rotation Rotation + * @param model model + * @param mask mask + * @param context qrcode context + * + */ +- (void)printQRcodeWithXPos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + eccLevel:(PTTSCQRcodeEcclevel)ecc_level + cellWidth:(PTTSCQRcodeWidth)width + mode:(PTTSCQRCodeMode)mode + rotation:(PTTSCStyleRotation)rotation + model:(PTTSCQRCodeModel)model + mask:(PTTSCQRcodeMask)mask + context:(NSString *)context; + +/*! + * \~chinese + * + * 打印图片. + * + * @brief 打印图片 + * @param xpos x起始坐标 + * @param ypos y起始坐标 + * @param mode 图形模式 + * @param image 打印的图片 + * @param bitmapMode 打印的图片模式 + * @param compress 压缩模式 + * @return 返回false的话,说明下发的图片数据大于打印机缓存区,应禁止下发 + * + * \~english + * + * Print Bitmap. + * + * @brief Print Bitmap + * @param xpos Specify the x-coordinate + * @param ypos Specify the y-coordinate + * @param mode Graphic modes + * @param image Image + * @param bitmapMode Bitmap mpde:binary/dithering + * @param compress Compress mode:TIFF/ZPL2/LZO/None + * @return The data is less than the cache and can be printed NO:The data exceeds the cache and cannot be printed + * + */ +- (BOOL)addBitmapWithXPos:(NSInteger)xpos + yPos:(NSInteger)ypos + mode:(PTTSCBitmapMode)mode + image:(CGImageRef)image + bitmapMode:(PTBitmapMode)bitmapMode + compress:(PTBitmapCompressMode)compress; + + + +/*! + * \~chinese + * + * 打印文本(针对点阵字库机型). + * + * @brief 打印文本(点阵字库) + * @param x_pos x起始坐标 + * @param y_pos y起始坐标 + * @param font 字体类型 + * @param rotation 旋转角度 + * @param x_multiplication 水平方向的放大倍数,1-10 + * @param y_multiplication 垂直方向的放大倍数,1-10 + * @param text 打印的文本内容 + * + * \~english + * + * Print Text(Printer for dot matrix font). + * + * @brief Print Text(Matrix Fonts) + * @param x_pos Specify the x-coordinate + * @param y_pos Specify the y-coordinate + * @param font Font type + * @param rotation Rotation + * @param x_multiplication Horizontal multiplication,up to 10x + * @param y_multiplication Vertical multiplication,up to 10x + * @param text print context + * + */ +- (void)appendTextWithXpos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + font:(PTTSCTextFontStyle)font + rotation:(PTTSCStyleRotation)rotation + xMultiplication:(NSInteger)x_multiplication + yMultiplication:(NSInteger)y_multiplication + text:(NSString *)text; + + +/*! + * \~chinese + * + * 打印自动换行文本(针对点阵字库机型). + * + * @brief 打印自动换行文本(点阵字库) + * @param x_pos x起始坐标 + * @param y_pos y起始坐标 + * @param font 字体类型 + * @param rotation 旋转角度 + * @param x_multiplication 水平方向的放大倍数,1-10 + * @param y_multiplication 垂直方向的放大倍数,1-10 + * @param safeHeight 打印的安全高度,自动换行超过该高度部分不会打印 + * @param width 打印的宽度,等于0表示不会自动换行 + * @param lineSpacing 行间距 + * @param text 打印的文本内容 + * + * \~english + * + * Print word wrap text(Printer for dot matrix font). + * + * @brief Print Word Wrap Text(Matrix Fonts) + * @param x_pos Specify the x-coordinate + * @param y_pos Specify the y-coordinate + * @param font Font type + * @param rotation Rotation + * @param x_multiplication Horizontal multiplication,up to 10x + * @param y_multiplication Vertical multiplication,up to 10x + * @param safeHeight Height of text field.Part will not print more than height + * @param width width of text field.if width is 0,not auto line + * @param lineSpacing line space. + * @param text print context + * + */ +- (NSInteger)printAutoTextWithXpos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + font:(PTTSCTextFontStyle)font + rotation:(PTTSCStyleRotation)rotation + xMultiplication:(NSInteger)x_multiplication + yMultiplication:(NSInteger)y_multiplication + safeHeight:(NSInteger)safeHeight + width:(NSInteger)width + lineSpacing:(NSInteger)lineSpacing + text:(NSString *)text; + +/*! + * \~chinese + * + * 打印文本(矢量和点阵字库机型). + * + * @brief 打印文本 + * @param x_pos x起始坐标 + * @param y_pos y起始坐标 + * @param font 字体类型 + * @param rotation 旋转角度 + * @param x_multiplication 水平方向的字体大小,如果字体类型是9,表示字体大小,否则表示的是放大倍数 + * @param y_multiplication 垂直方向的字体大小,如果字体类型是9,表示字体大小,否则表示的是放大倍数 + * @param text 打印的文本内容 + * + * \~english + * + * Print Text(Printer for vector fonts and dot fonts). + * + * @brief Print Text + * @param x_pos Specify the x-coordinate + * @param y_pos Specify the y-coordinate + * @param font Font type + * @param rotation Rotation + * @param x_multiplication Horizontal font size,If the type is 9, said the font size, or said is magnification + * @param y_multiplication Vertical font size,If the type is 9, said the font size, or said is magnification + * @param text print context + * + */ +- (void)appendTextForVectorWithXpos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + font:(PTTSCTextVectorFontStyle)font + rotation:(PTTSCStyleRotation)rotation + xMultiplication:(NSInteger)x_multiplication + yMultiplication:(NSInteger)y_multiplication + text:(NSString *)text; + +/*! + * \~chinese + * + * 打印自动换行文本(矢量和点阵字库机型). + * + * @brief 打印自动换行文本(矢量字库) + * @param x_pos x起始坐标 + * @param y_pos y起始坐标 + * @param font 字体类型 + * @param rotation 旋转角度 + * @param x_multiplication 水平方向的字体大小,如果字体类型是9,表示字体大小,否则表示的是放大倍数 + * @param y_multiplication 垂直方向的字体大小,如果字体类型是9,表示字体大小,否则表示的是放大倍数 + * @param safeHeight 打印的安全高度,自动换行超过该高度部分不会打印 + * @param width 打印的宽度,等于0表示不会自动换行 + * @param lineSpacing 行间距 + * @param text 打印的文本内容 + * + * \~english + * + * Print word wrap text(Printer for vector fonts and dot fonts). + * + * @brief Print Word Wrap Text(Vector Fonts) + * @param x_pos Specify the x-coordinate + * @param y_pos Specify the y-coordinate + * @param font Font type + * @param rotation Rotation + * @param x_multiplication Horizontal font size,If the type is 9, said the font size, or said is magnification + * @param y_multiplication Vertical font size,If the type is 9, said the font size, or said is magnification + * @param safeHeight Height of text field.Part will not print more than height + * @param width width of text field.if width is 0,not auto line + * @param lineSpacing line space. + * @param text print context + * + */ +- (NSInteger)printAutoTextForVectorWithXpos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + font:(PTTSCTextVectorFontStyle)font + rotation:(PTTSCStyleRotation)rotation + xMultiplication:(NSInteger)x_multiplication + yMultiplication:(NSInteger)y_multiplication + safeHeight:(NSInteger)safeHeight + width:(NSInteger)width + lineSpacing:(NSInteger)lineSpacing + text:(NSString *)text; + +/*! + * \~chinese + * + * 将指定区域反白打印 + * + * @brief 反白打印 + * @param x_start x方向起点坐标(以点为单位) + * @param y_start y方向起点坐标(以点为单位) + * @param x_width x方向反白区域宽度(以点为单位) + * @param y_height y方向反白区域高度(以点为单位) + * + * \~english + * + * This command reverses a region in image buffer. + * + * @brief Reverses + * @param x_start The x-coordinate of the starting point (in dots) + * @param y_start The y-coordinate of the starting point (in dots) + * @param x_width X-axis region width (in dots) + * @param y_height Y-axis region height (in dots) + * + */ +- (void)setReverseWithXStart:(NSInteger)x_start + yStart:(NSInteger)y_start + xWidth:(NSInteger)x_width + yHeight:(NSInteger)y_height; + +/*! + * \~chinese + * + * 在标签上绘制矩形. + * + * @brief 绘制矩形 + * @param x_start x起始坐标 + * @param y_start y起始坐标 + * @param x_end x终点坐标 + * @param y_end y终点坐标 + * @param thickness 线条宽度 + * + * \~english + * + * This command draws rectangles on the label. + * + * @brief Draws Rectangles + * @param x_start Specify x-coordinate of upper left corner (in dots) + * @param y_start Specify y-coordinate of upper left corner (in dots) + * @param x_end Specify x-coordinate of lower right corner (in dots) + * @param y_end Specify y-coordinate of lower right corner (in dots) + * @param thickness Line thickness (in dots) + * + */ +- (void)setBoxWithXStart:(NSInteger)x_start + yStart:(NSInteger)y_start + xEnd:(NSInteger)x_end + yEnd:(NSInteger)y_end + thickness:(NSInteger)thickness; + + +/*! + * \~chinese + * + * 在标签上绘制椭圆. + * + * @brief 绘制椭圆 + * @param x_start 指定左上角的x坐标(以点为单位) + * @param y_start 指定左上角的y坐标(以点为单位) + * @param width 椭圆的宽度(以点为单位) + * @param height 椭圆的高度(以点为单位) + * @param thickness 椭圆的厚度(以点为单位) + * + * \~english + * + * Draw an ellipse on the label. + * + * @brief Draw Ellipse + * @param x_start Specify x-coordinate of upper left corner (in dots) + * @param y_start Specify y-coordinate of upper left corner (in dots) + * @param width Specify the width of the ellipse (in dots) + * @param height Specify the height of the ellipse (in dots) + * @param thickness Thickness of the ellipse (in dots) + * + */ +- (void)setEllipseWithXStart:(NSInteger)x_start + yStart:(NSInteger)y_start + width:(NSInteger)width + height:(NSInteger)height + thickness:(NSInteger)thickness; + +/*! + * \~chinese + * + * 在标签上绘制圆形. + * + * @brief 绘制圆形 + * @param x_start 指定左上角的x坐标(以点为单位) + * @param y_start 指定左上角的y坐标(以点为单位) + * @param diameter 指定圆的直径(以点为单位) + * @param thickness 圆的厚度(以点为单位) + * + * \~english + * + * This command draws a circle on the label. + * + * @brief Draw Circle + * @param x_start Specify x-coordinate of upper left corner (in dots) + * @param y_start Specify y-coordinate of upper left corner (in dots) + * @param diameter Specify the diameter of the circle (in dots) + * @param thickness Thickness of the circle (in dots) + * + */ +- (void)setCircleWithXStart:(NSInteger)x_start + yStart:(NSInteger)y_start + diameter:(NSInteger)diameter + thickness:(NSInteger)thickness; + +/*! + * \~chinese + * + * 清除图像缓冲区中的特定区域. + * + * @brief 清除缓冲区某区域 + * @param x_start 起点的x坐标(以点为单位) + * @param y_start 起点的y坐标(以点为单位) + * @param x_width x轴方向的区域宽度(以点为单位) + * @param y_height y轴方向的区域宽度(以点为单位) + * + * \~english + * + * This command clears a specified region in the image buffer. + * + * @brief Clear Specified BBuffer + * @param x_start The x-coordinate of the starting point (in dots) + * @param y_start The x-coordinate of the starting point (in dots) + * @param x_width The region width in x-axis direction (in dots) + * @param y_height The region height in y-axis direction (in dots) + * + */ +- (void)setEraseWithXStart:(NSInteger)x_start + yStart:(NSInteger)y_start + xWidth:(NSInteger)x_width + yHeight:(NSInteger)y_height; + +/*! + * \~chinese + * + * 打印DMATRIX二维条码. + * + * @brief 打印DMATRIX二维条码 + * @param x_pos 条形码水平方向起始位置,以点表示 + * @param y_pos 条形码垂直方向起始位置,以点表示 + * @param width 条码宽度,以点表示 + * @param height 条码高度,以点表示 + * @param xm 模块尺寸 + * @param row 条形码列数:10-144 + * @param col 条形码栏数:10-144 + * @param expresssion 条形码内容 + * + * \~english + * + * This command is used to define the DataMatrix 2D bar code. + * + * @brief DataMatrix 2D Barcode + * @param x_pos Specify the x-coordinate of the bar code on the label + * @param y_pos Specify the y-coordinate of the bar code on the label + * @param width The expected width of barcode area (in dots) + * @param height The expected height of barcode area (in dots) + * @param xm Module size (in dots) + * @param row Symbol size of row: 10 to 144 + * @param col Symbol size of col: 10 to 144 + * @param expresssion Barcode content + * + */ +- (void)drawDmatrixBarcodeWithXPos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + width:(NSInteger)width + height:(NSInteger)height + xm:(PTTSCDMATRIXSize)xm + row:(NSInteger)row + col:(NSInteger)col + expression:(NSString *)expresssion; + + +/*! + * \~chinese + * + * 打印PDF417条码. + * + * @brief 打印PDF417条码 + * @param x_pos 条形码水平方向起始位置,以点表示 + * @param y_pos 条形码垂直方向起始位置,以点表示 + * @param width 条码宽度,以点表示 + * @param height 条码高度,以点表示 + * @param rotate 条码码旋转 + * @param option 可选参数,详情在文档给出 + * @param expresssion 条形码内容 + * + * \~english + * + * This command defines a PDF417 2D barcode. + * + * @brief PDF417 Barcode + * @param x_pos Specify the x-coordinate of the bar code on the label + * @param y_pos Specify the y-coordinate of the bar code on the label + * @param width The expected width of barcode area (in dots) + * @param height The expected height of barcode area (in dots) + * @param rotate Rotation counterclockwise. + * @param option Details are given in the documentation + * @param expresssion Barcode content + * + */ +- (void)printPDF417WithXPos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + width:(NSInteger)width + height:(NSInteger)height + rotate:(PTTSCStyleRotation)rotate + option:(NSString *)option + expression:(NSString *)expression; + +/*! + * \~chinese + * + * 打印AZTEC条码. + * + * @brief 打印AZTEC条码 + * @param xPos 条形码水平方向起始位置,以点表示 + * @param yPos 条形码垂直方向起始位置,以点表示 + * @param rotate 旋转角度 + * @param size 元素模块大小(1到20),默认为6 + * @param ecp 错误控制(&符号大小/类型)参数 + * @param flg 0:输入消息是直字节 1:输入使用 + * @param menu 菜单符号(0:否,1:是),默认为0 + * @param multi 符号数(1到26),默认为6 + * @param rev 输出要反转(0:否,1:是),默认为0 + * @param aztecData 条形码内容 + * + * \~english + * + * This command defines a AZTEC 2D barcode. + * + * @brief AZTEC Barcode + * @param xPos Specify the x-coordinate of the bar code on the label + * @param yPos Specify the y-coordinate of the bar code on the label + * @param rotate Rotation + * @param size Element module size (1 to 20), default is 6 + * @param ecp Error control (& symbol size/type) parameter + * @param flg 0 : input message is straight bytes 1:input uses + * @param menu Menu symbol (0 : no, 1 : yes), default is 0 + * @param multi Number of symbols (1 to 26), default is 6 + * @param rev Output to be reversed (0 : no, 1 : yes), default is 0 + * @param aztecData Barcode content + * + */ +- (void)printAztecWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + rotate:(PTTSCStyleRotation)rotate + size:(NSInteger)size + ecp:(NSInteger)ecp + flg:(NSInteger)flg + menu:(NSInteger)menu + multi:(NSInteger)multi + rev:(NSInteger)rev + aztecData:(NSString *)aztecData; + + +/*! + * \~chinese + * + * 打印BMP格式图像. + * + * @brief 打印BMP格式图像 + * @param filename 下载的BMP文件名 + * @param x_pos BMP格式图像的x坐标 + * @param y_pos BMP格式图像的y坐标 + * + * \~english + * + * This command prints BMP format images. + * + * @brief BMP Format Image + * @param filename The downloaded BMP filename. + * @param x_pos The x-coordinate of the BMP format image + * @param y_pos The y-coordinate of the BMP format image + * + */ +- (void)printBMPWithFilename:(NSString *)filename + xPos:(NSInteger)x_pos + yPos:(NSInteger)y_pos; + +/*! + * \~chinese + * + * 打印PCX格式图像. + * + * @brief 打印PCX格式图像 + * @param filename 下载的PCX文件名 + * @param x_pos PCX格式图像的x坐标 + * @param y_pos PCX格式图像的y坐标 + * + * \~english + * + * This command prints PCX format images. + * + * @brief PCX Format Image + * @param filename The downloaded PCX filename. + * @param x_pos The x-coordinate of the PCX format image + * @param y_pos The y-coordinate of the PCX format image + * + */ +- (void)printPCXWithFilename:(NSString *)filename + xPos:(NSInteger)x_pos + yPos:(NSInteger)y_pos; + + +///////////////////////////////////////////////////////////////////// +/********************* Device Reconfiguration Commands ********************/ +///////////////////////////////////////////////////////////////////// + +/*! + * \~chinese + * + * 计数器设置. + * + * @brief 计数器设置 + * @param counterNumber 表示选择哪个计数器:0-50 + * @param step 表示计数间隔(-99999999 ~ 99999999) + * + * \~english + * + * Counters can be a real counter or a variable.This setting sets the counter number in the program and its increments. + * + * @brief Set The Counter + * @param counterNumber counter number. There are 51 counters available (@0~@50) in the printer. + * @param step The increment of the counter, can be positive or negative.(-99999999 ~ 99999999) + * + */ +- (void)setCounterWithCounterNumber:(NSInteger)counterNumber + step:(NSInteger)step; + +/*! + * \~chinese + * + * 设置打印机切割器状态. + * + * @brief 切割器状态 + * @param status true:打印结束后切割 false:禁用切刀功能 + * + * \~english + * + * This setting activates or deactivates the cutter. + * + * @brief Cutter Status + * @param status true:Set printer to cut label at the end of printing job false:Disable cutter function + * + */ +- (void)setCutterStatus:(BOOL)status; + +/*! + * \~chinese + * + * 设置每个切割的打印标签数量 + * + * @brief 切割数量 + * @param pieces 0 ~ 65535 + * + * \~english + * + * Set number of printing labels per cut. + * + * @brief Number Of Cut + * @param pieces 0 ~ 65535 + * + */ +- (void)setCutterPieces:(NSInteger)pieces; + + + +@end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTCommandZPL.h b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandZPL.h new file mode 100644 index 0000000..0877913 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTCommandZPL.h @@ -0,0 +1,2651 @@ +/*! + * \~chinese + * @header PTCommandZPL.h + * @abstract ZPL指令 + * + * \~english + * @header PTCommandZPL.h + * @abstract ZPL Command + */ + +#import +#import "PTBitmap.h" +NS_ASSUME_NONNULL_BEGIN + +/** + Fonts currently supported by the printer + 打印机目前支持的字体 + + index name font_id 字符集/character set + 0 arial.ttf 0 0 + 1 GB2312.ttf 1 2 + 2 fontA.FNT A 0 + 3 fontB.FNT B 0 + 4 fontC.FNT C 0 + 5 fontD.FNT D 0 + 6 fontE.FNT E 0 + 7 fontF.FNT F 0 + 8 fontG.FNT G 0 + 9 fontH.FNT H 0 + 10 fontGS.FNT I 0 + + Process mode: if it exceeds the ID range, the program will set it as “c” font + 处理方式:如果超过ID 范围,程序将设置为 “c”字体 + */ + + +typedef NS_ENUM(UInt8, PTZplOrientation) { + /*! \~chinese 正向 \~english normal */ + PTZplOrientation_N = 'N', + /*! \~chinese 顺时针旋转90度 \~english rotate 90 degrees (clockwise) */ + PTZplOrientation_R = 'R', + /*! \~chinese 180度旋转 \~english inverted 180 degrees */ + PTZplOrientation_I = 'I', + /*! \~chinese 270度旋转 \~english read from bottom up, 270 degrees */ + PTZplOrientation_B = 'B' +}; + +typedef NS_ENUM(UInt8, PTZplFont) { + + PTZplFont0 = '0', + PTZplFont1 = '1', + PTZplFontA = 'A', + PTZplFontB = 'B', + PTZplFontC = 'C', + PTZplFontD = 'D', + PTZplFontE = 'E', + PTZplFontF = 'F', + PTZplFontG = 'G', + PTZplFontH = 'H', + PTZplFontI = 'I' +}; + +//source location +typedef NS_ENUM(UInt8, PTZplFileLocation) { + /*! \~chinese 文件路径R: \~english file location R: */ + PTZplFileLocation_R = 'R', + /*! \~chinese 文件路径E: \~english file location E: */ + PTZplFileLocation_E = 'E', + /*! \~chinese 文件路径B: \~english file location B: */ + PTZplFileLocation_B = 'B', + /*! \~chinese 文件路径A: \~english file location A: */ + PTZplFileLocation_A = 'A' +}; + +typedef NS_ENUM(UInt8, PTZplBool) { + /*! \~chinese 是 \~english yes */ + PTZplBool_Y = 'Y', + /*! \~chinese 否 \~english no */ + PTZplBool_N = 'N' +}; + +typedef NS_ENUM(UInt8, PTZplCodeBlockBarCodeMode) { + /*! \~chinese Code 39 字符集 \~english use Code 39 character set */ + PTZplCodeBlockBarCodeMode_A = 'A', + /*! \~chinese Code 128 字符集 \~english use Code 128 character set */ + PTZplCodeBlockBarCodeMode_F = 'F', + /*! \~chinese Code 128 字符集并自动添加FNC1. \~english use the Code 128 character set and automatically adds FNC1. */ + PTZplCodeBlockBarCodeMode_E = 'E' +}; + +typedef NS_ENUM(UInt8, PTZplCode128Mode) { + /*! \~chinese 不选择模式 \~english no selected mode */ + PTZplCode128Mode_N = 'N', + /*! \~chinese UCC Case 模式 \~english UCC Case Mode */ + PTZplCode128Mode_U = 'U', + /*! \~chinese 自动模式 \~english Automatic Mode */ + PTZplCode128Mode_A = 'A', + /*! \~chinese UCC/EAN Mode \~english UCC/EAN Mode */ + PTZplCode128Mode_D = 'D' +}; + +typedef NS_ENUM(UInt8, PTZplJustification) { + /*! \~chinese 左对齐 \~english left justication */ + PTZplJustificationLeft = '0', + /*! \~chinese 右对齐 \~english right justication */ + PTZplJustificationRight = '1', + /*! \~chinese 自动对齐 \~english auto justication */ + PTZplJustificationAuto = '2' +}; + +typedef NS_ENUM(UInt8, PTZplColor) { + /*! \~chinese 黑色 \~english black color */ + PTZplColorBlack = 'B', + /*! \~chinese 白色 \~english white color */ + PTZplColorWhite = 'W' +}; + +typedef NS_ENUM(UInt8, PTZplDiagonalOrientation) { + /*! \~chinese 右靠斜线 \~english right leaning diagonal */ + PTZplDiagonalOrientationLeaningRight = 'R', + /*! \~chinese 左靠斜线 \~english left leaning diagonal */ + PTZplDiagonalOrientationLeaningLeft = 'L' +}; + +typedef NS_ENUM(UInt8, PTZplMediaType) { + /*! \~chinese 热转印介质 \~english thermal transfer media */ + PTZplMediaTypeThermalTransfer = 'T', + /*! \~chinese 热敏介质 \~english direct thermal media */ + PTZplMediaTypeDirectThermal = 'D' +}; + +typedef NS_ENUM(UInt8, PTZplQrReliabilityLevel) { + /*! \~chinese 极高可靠级别 \~english ultra-high reliability level */ + PTZplQrReliabilityLevel_H = 'H', + /*! \~chinese 高可靠级别 \~english high reliability level */ + PTZplQrReliabilityLevel_Q = 'Q', + /*! \~chinese 标准级别 \~english standard level */ + PTZplQrReliabilityLevel_M = 'M', + /*! \~chinese ⾼密度级别 \~english high density level level */ + PTZplQrReliabilityLevel_L = 'L' +}; + +typedef NS_ENUM(UInt8, PTZplQrModel) { + /*! \~chinese 标准 \~english original */ + PTZplQrModel_1 = '1', + /*! \~chinese 增强 \~english enhanced */ + PTZplQrModel_2 = '2' +}; + +typedef NS_ENUM(UInt8, PTZplTextPrintDirection) { + /*! \~chinese 水平打印(由左至右) \~english horizontal printing (left to right) */ + PTZplTextPrintDirection_H = 'H', + /*! \~chinese 垂直打印(由上至下) \~english vertical printing (top to bottom) */ + PTZplTextPrintDirection_V = 'V', + /*! \~chinese 反向打印(由上至下) \~english reverse printing (right to left) */ + PTZplTextPrintDirection_R = 'R' +}; + +typedef NS_ENUM(UInt8, PTZplPrintOrientation) { + /*! \~chinese 通用打印 \~english normal */ + PTZplPrintOrientation_N = 'N', + /*! \~chinese 反向打印 \~english invert */ + PTZplPrintOrientation_I = 'I' +}; + +typedef NS_ENUM(UInt8, PTZplUpsMaxiCodeMode) { + /*! \~chinese 结构化信息载体:数字邮政编码(U.S.) \~english structured carrier message: numeric postal code (U.S.) */ + PTZplUpsMaxiCodeMode_2 = '2', + /*! \~chinese 结构化信息载体:数字邮政编码(non-U.S.) \~english structured carrier message: numeric postal code (non-U.S.) */ + PTZplUpsMaxiCodeMode_3 = '3', + /*! \~chinese 标准符号 \~english standard symbol, secretary */ + PTZplUpsMaxiCodeMode_4 = '4', + /*! \~chinese 全EEC \~english full EEC */ + PTZplUpsMaxiCodeMode_5 = '5', + /*! \~chinese reader program \~english reader program, secretary */ + PTZplUpsMaxiCodeMode_6 = '6' +}; + +typedef NS_ENUM(UInt8, PTCode49InterpretationLineStyle) { + /*! \~chinese 不打印解释行 \~english no line printed. */ + PTCode49InterpretationLineStyle_N = 'N', + /*! \~chinese 在条码上方打印解释行 \~english print interpretation line above code. */ + PTCode49InterpretationLineStyle_A = 'A', + /*! \~chinese 在条码下方打印解释行 \~english print interpretation line below code. */ + PTCode49InterpretationLineStyle_B = 'B' +}; + +typedef NS_ENUM(UInt8, PTZplPrintMode) { + /*! \~chinese 撕扯 \~english tear. */ + PTZplPrintMode_T = 'T', + /*! \~chinese 剥离 \~english stripper. */ + PTZplPrintMode_P = 'P', + /*! \~chinese 回卷 \~english rollback model. */ + PTZplPrintMode_R = 'R', + /*! \~chinese 贴标机 \~english Labeling machine. */ + PTZplPrintMode_A = 'A', + /*! \~chinese 切纸器 \~english Paper cutting machine. */ + PTZplPrintMode_C = 'C', + /*! \~chinese 延迟切纸器 \~english Delay paper cutter. */ + PTZplPrintMode_D = 'D', + /*! \~chinese RFID \~english RFID. */ + PTZplPrintMode_F = 'F', + /*! \~chinese 自助终端模式 \~english Self-service terminal mode. */ + PTZplPrintMode_K = 'K' +}; + +@interface PTCommandZPL : NSObject + +/*! + * \~chinese + * + * 下发给打印机的数据. + * + * \~english + * + * Data sent to the printer. + * + */ +@property (nonatomic, strong, readonly) NSMutableData *cmdData; + +/*! + * \~chinese + * + * 指令使用的编码,默认是GBK. + * + * \~english + * + * encode,default is GBK. + * + */ +@property (nonatomic, assign) NSStringEncoding encoding; + +#pragma mark - ZPL Commands + +/*! + * \~chinese + * 打印自检页 + * @brief 打印自检页 + * + * \~english + * generate a printer configuration label + * @brief generate a printer configuration label + * + */ +- (void)printSelfTest; + +/*! + * \~chinese + * 走纸一行 + * @brief 走纸一行 + * + * \~english + * feed a line + * @brief feed a line + */ +- (void)zplLineFeed; + +#pragma mark ^A + +/*! + * \~chinese + * + * 设置字体 + * + * @brief 使用字体名设置字体朝向、大小 + * @param fontName 字体名 + * @param fieldOrientation 字体朝向 + * @param characterHeight 字体高度(点) 10~3200 + * @param width 字体宽度(点) 10~3200 + * + * \~english + * + * specifies the font to use in a text field. + * + * @brief set font orientation and size with font name + * @param fontName font name. + * @param fieldOrientation field orientation. + * @param characterHeight font height in dots. 10~3200 + * @param width font width in dots. 10~3200 + * + */ +- (void)A_SetFont:(PTZplFont)fontName + fieldOrientation:(PTZplOrientation)fieldOrientation + characterHeight:(NSInteger)characterHeight + width:(NSInteger)width; + +/*! + * \~chinese + * + * 设置字体. + * + * @brief 使用字体名设置字体朝向 + * @param fontName 字体名 + * @param fieldOrientation 字体朝向 + * + * \~english + * + * specifies the font to use in a text field. + * + * @brief set font orientation with font name + * @param fontName font name. + * @param fieldOrientation field orientation. + * + */ +- (void)A_SetFont:(PTZplFont)fontName fieldOrientation:(PTZplOrientation)fieldOrientation; + +/*! + * \~chinese + * + * 设置字体. + * + * @brief 使用字体名设置字体大小 + * @param fontName 字体名 + * @param characterHeight 字体高度(点) 10~3200 + * @param width 字体宽度(点) 10~3200 + * + * \~english + * + * specifies the font to use in a text field. + * + * @brief set font size with font name + * @param fontName font name. + * @param characterHeight font height in dots. 10~3200 + * @param width font width in dots. 10~3200 + * + */ +- (void)A_SetFont:(PTZplFont)fontName + characterHeight:(NSInteger)characterHeight + width:(NSInteger)width; + +/*! + * \~chinese + * + * 设置字体. + * + * @brief 使用字体名设置字体 + * @param fontName 字体名 + * + * \~english + * + * + * specifies the font to use in a text field. + * + * @brief set font with font name + * @param fontName font name. + * + */ +- (void)A_SetFont:(PTZplFont)fontName; + +#pragma mark ^A@ + +/*! + * \~chinese + * + * 使用字体文件设置字体,打印中文建议使用该接口 + * + * @brief 使用字体文件设置字体朝向、大小 + * @param orientation 字体朝向 + * @param height 字体高度(点) 10~3200 + * @param width 字体宽度(点) 10~3200 + * @param location 字体文件所在位置,默认选择E + * + * \~english + * + * specifies the font by the complete name of a font,this interface is recommended for printing Chinese + * + * @brief set font orientation and size with file + * @param orientation text orientation. + * @param height charcter heigt in dots (10~32000). + * @param width charcter width in dots (10~32000). + * @param location location of font file,default E + * + */ +- (void)A_SetFontWithOrientation:(PTZplOrientation)orientation + height:(NSInteger)height + width:(NSInteger)width + location:(PTZplFileLocation)location; + +/*! + * \~chinese + * + * 使用字体文件设置字体 + * + * @brief 设置字体朝向、大小 + * @param orientation 字体朝向 + * @param height 字体高度(点) 10~3200 + * @param width 字体宽度(点) 10~3200 + * + * \~english + * + * specifies the font by the complete name of a font. + * + * @brief set font orientation and size + * @param orientation text orientation. + * @param height charcter heigt in dots (10~32000). + * @param width charcter width in dots (10~32000). + * + */ +- (void)A_SetFontWithOrientation:(PTZplOrientation)orientation + height:(NSInteger)height + width:(NSInteger)width; + +#pragma mark ^B0 + +/*! + * \~chinese + * + * 生成Aztec码 + * + * @brief Aztec码 + * @param orientation 朝向 + * @param magnificationFactor 放大系数 + * @param isContainECIC 是否包含ECIC + * @param errorAndSymbol 纠错和符号大小 0,01~99,101~104,201~232,300 + * @param isMenuSymbol 是否包含菜单指示符 + * @param appendSymbolNumber 结构化附加的符号数量 1~26 + * @param appendOptionalID 用于结构化附加的可选ID字段 + * + * \~english + * + * Aztec Bar Code + * + * @brief Aztec Bar Code + * @param orientation orientation. + * @param magnificationFactor magnification factor. + * @param isContainECIC whether data contains ECICs. + * @param errorAndSymbol error control and symbol size/type indicator. 0,01~99,101~104,201~232,300. + * @param isMenuSymbol whether this symbol is to be a menu (bar code reader initialization) symbol. + * @param appendSymbolNumber number of symbols for structured append. 1~26 + * @param appendOptionalID optional ID field for structured append. + * + */ +- (void)B0_BacodeAztecWithOrientation:(PTZplOrientation)orientation + magnificationFactor:(NSInteger)magnificationFactor + isContainECIC:(PTZplBool)isContainECIC + errorAndSymbol:(NSInteger)errorAndSymbol + isMenuSymbol:(PTZplBool)isMenuSymbol + appendSymbolNumber:(NSInteger)appendSymbolNumber + appendOptionalID:(NSString *)appendOptionalID; + + + +#pragma mark ^B1 + +/*! + * \~chinese + * + * 生成Code11码 + * + * @brief Code11码 + * @param orientation 朝向 + * @param checkDigit 校验位 Y->1 N->2 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * Code 11 Bar Code + * + * @brief Code 11 Bar Code + * @param orientation orientation. + * @param checkDigit check digit Y->1 N->2. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)B1_BacodeCode11WithOrientation:(PTZplOrientation)orientation + checkDigit:(PTZplBool)checkDigit + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode; + +#pragma mark ^B3 + +/*! + * \~chinese + * + * 生成Code39码 + * + * @brief Code39码 + * @param orientation 朝向 + * @param checkDigit Mod-43 校验位 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * Code 39 Bar Code + * + * @brief Code 39 Bar Code + * @param orientation orientation. + * @param checkDigit Mod-43 check digit. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)B3_BacodeCode39WithOrientation:(PTZplOrientation)orientation + checkDigit:(PTZplBool)checkDigit + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode; + +#pragma mark ^B4 Code 49 码 + +/*! + * \~chinese + * + * 生成Code49码 + * + * @brief Code49码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param style 解释行样式 + * + * \~english + * + * Code 49 Bar Code + * + * @brief Code 49 Bar Code + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param style interpretation line style. + * + */ +- (void)B4_BacodePlanetCodeWithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLineStyle:(PTCode49InterpretationLineStyle)style; + +#pragma mark ^B7 PDF417 码 + +/*! + * \~chinese + * + * 生成PDF417码 + * + * @brief PDF417码 + * @param orientation 朝向 + * @param barcodeHeight 各层的条码高度(点),不建议取1 + * @param securityLevel 安全级别 1~8 + * @param columns 要编码的数据列数 1~30 + * @param rows 要编码的行数 3~90 + * @param truncation 是否截断层右行指示符和终止图案 + * + * \~english + * + * PDF417 Bar Code + * + * @brief PDF417 Bar Code + * @param orientation orientation + * @param barcodeHeight bar code height for individual rows (in dots).1 is not a recommended value. + * @param securityLevel security level, 1~8. + * @param columns number of data columns to encode, 1~30. + * @param rows number of rows to encode, 3~90. + * @param truncation whether truncate right row indicators and stop pattern. + * + */ +- (void)B7_BarcodePDF417CodeWithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + securityLevel:(NSInteger)securityLevel + columns:(NSInteger)columns + rows:(NSInteger)rows + truncation:(PTZplBool)truncation; +#pragma mark ^B8 EAN-8 条码 + +/*! + * \~chinese + * + * 生成EAN-8码 + * + * @brief EAN-8码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * EAN-8 Bar Code + * + * @brief EAN-8 Bar Code + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)B8_BacodeEAN8WithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode; + +#pragma mark ^B9 UPC-E 条码 + +/*! + * \~chinese + * + * 生成UPC-E码 + * + * @brief UPC-E码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * UPC-E Bar Code + * + * @brief UPC-E Bar Code + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)B9_BarcodeUPCE8CodeWithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode + checkDigit:(PTZplBool)checkDigit; + +#pragma mark ^BA Code 93 条码 + +/*! + * \~chinese + * + * 生成Code93码 + * + * @brief Code93码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * Code 93 Bar Code + * + * @brief Code 93 Bar Code + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)BA_BarcodeCode93WithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode + checkDigit:(PTZplBool)checkDigit; + +#pragma mark ^BB CodeBlock 条码 + +/*! + * \~chinese + * + * CODABLOCK 条码 + * + * @brief CODABLOCK 条码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param securityLevel 安全 + * @param perRowCharacters 每行的字符数 2-62 + * @param rows 要编码的行数 + * @param mode 模式 + * + * \~english + * + * CODABLOCK Bar Code. + * + * @brief CODABLOCK Bar Code. + * @param orientation orientation. + * @param barcodeHeight bar code height for individual rows in dots, 1~32000. + * @param securityLevel security. + * @param perRowCharacters number of characters per row, 2-62. + * @param rows number of rows to encode. + * @param mode mode. + * + */ +- (void)BB_BarcodeCodeBlockWithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + securityLevel:(PTZplBool)securityLevel + perRowCharacters:(NSInteger)perRowCharacters + rows:(NSInteger)rows + mode:(PTZplCodeBlockBarCodeMode)mode; +#pragma mark ^BC Code 128 条码 + +/*! + * \~chinese + * + * 生成Code128码(子集A、B和C) + * + * @brief Code128码(子集A、B和C) + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * @param checkDigit UCC校检位 + * @param mode 模式 + * + * \~english + * + * Code 128 Bar Code (Subsets A, B, and C). + * + * @brief Code 128 Bar Code (Subsets A, B, and C) + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * @param checkDigit UCC check digit. + * @param mode mode. + * + */ +- (void)BC_BarcodeCode128WithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode + checkDigit:(PTZplBool)checkDigit + mode:(PTZplCode128Mode)mode; + +#pragma mark ^BD UPS Maxicode 条码 + +/*! + * \~chinese + * + * UPS MaxiCode 条码. + * + * @brief UPS MaxiCode 条码 + * @param mode 模式 + * @param symbolNumber 符号编号 1~8 + * @param totalSymbolNumbers 符号总数 1~8 + * + * \~english + * + * UPS MaxiCode Bar Code + * + * @brief UPS MaxiCode Bar Code + * @param mode mode. + * @param symbolNumber symbol number, 1~8. + * @param totalSymbolNumbers total number of symbols, 1~8. + * + */ +- (void)BD_BarcodeUPSMaxicodeWithMode:(PTZplUpsMaxiCodeMode)mode + symbolNumber:(NSInteger)symbolNumber + totalSymbolNumbers:(NSInteger)totalSymbolNumbers; + +#pragma mark ^BE EAN-18 条码 + +/*! + * \~chinese + * + * 生成EAN-13码 + * + * @brief EAN-13码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * EAN-13 Bar Code + * + * @brief EAN-13 Bar Code + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)BE_BacodeEAN13WithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode; +#pragma mark ^BF 微型 PDF417 条码 + +/*! + * \~chinese + * + * 生成MicroPDF417条码 + * + * @brief MicroPDF417条码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~9999 + * @param mode 模式 0~33 + * + * \~english + * + * MicroPDF417 Bar Code. + * + * @brief MicroPDF417 Bar Code + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~9999. + * @param mode mode, 0~33. + * + */ +- (void)BF_BarcodeMicroPDF417WithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + mode:(NSInteger)mode; + +#pragma mark ^BI 工业二五码 + +/*! + * \~chinese + * + * 生成工业二五码 + * + * @brief 工业二五码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * Industrial 2 of 5 Bar Codes. + * + * @brief Industrial 2 of 5 Bar Codes + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)BI_BacodeIndustrial2of5WithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode; + +#pragma mark ^BJ 标准二五码 + +/*! + * \~chinese + * + * 生成标准二五码 + * + * @brief 标准二五码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * Standard 2 of 5 Bar Code. + * + * @brief Standard 2 of 5 Bar Code + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)BJ_BacodeStandard2of5WithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode; + +#pragma mark ^BK ANSI Codebar + +/*! + * \~chinese + * + * 生成ANSI Codabar 条码 + * + * @brief ANSI Codabar条码 + * @param orientation 朝向 + * @param checkDigit 校检位 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * @param startCharacter 指定起始字符 (A,B,C,D) + * @param stopCharacter 指定终止字符 (A,B,C,D) + * + * \~english + * + * ANSI Codabar Bar Code. + * + * @brief ANSI Codabar Bar Code + * @param orientation orientation. + * @param checkDigit check digit. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * @param startCharacter designates a start character. (A,B,C,D) + * @param stopCharacter designates stop character. (A,B,C,D) + * + */ +- (void)BK_BarcodeANSICodebarWithOrientation:(PTZplOrientation)orientation + checkDigit:(PTZplBool)checkDigit + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode + startCharacter:(NSString *)startCharacter + stopCharacter:(NSString *)stopCharacter; + + +#pragma mark ^BL LOGMARS 条码 + +/*! + * \~chinese + * + * LOGMARS 条码 + * + * @brief LOGMARS条码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param isPrint 是否在条码上方打印解释行 + * + * \~english + * + * LOGMARS Bar Code. + * + * @brief LOGMARS Bar Code + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param isPrint whether print interpretation line above code. + * + */ +- (void)BL_BacodeLOGMARSWithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + printInterpretationLineAboveCode:(PTZplBool)isPrint; + +#pragma mark ^BQ QRcode 二维码 + +/*! + * \~chinese + * + * 生成QR码 + * + * @brief QR码 + * @param orientation 朝向 + * @param model 模式 + * @param magnification 放大系数 1~10 + * @param reliabilityLevel 可靠性等级 + * + * \~english + * + * QR Code Bar Code. + * + * @brief QR Code Bar Code + * @param orientation orientation. + * @param model orientation. + * @param magnification magnification factor. + * @param reliabilityLevel reliability level. + * + */ +- (void)BQ_BarcodeQRcodeWithOrientation:(PTZplOrientation)orientation + model:(PTZplQrModel)model + magnification:(NSInteger)magnification + reliabilityLevel:(PTZplQrReliabilityLevel)reliabilityLevel; + +#pragma mark ^BS + +/*! + * \~chinese + * + * @brief + * 生成UPC/EAN扩展码 + * + * @brief UPC/EAN扩展码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~32000 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * + * \~english + * + * UPC/EAN Extensions. + * + * @brief UPC/EAN Extensions + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~32000. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * + */ +- (void)BS_BacodeUPCEANExtensionsWithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode; + +#pragma mark ^BU UPC-A 条码 + +/*! + * \~chinese + * + * 生成UPC/EAN扩展码 + * + * @brief UPC/EAN扩展码 + * @param orientation 朝向 + * @param barcodeHeight 条码高度(点) 1~9999 + * @param interpretationLine 是否打印解释行 + * @param aboveCode 解释行是否打印于条码上方 + * @param checkDigit 是否打印校检位 + * + * \~english + * + * UPC/EAN Extensions. + * + * @brief UPC/EAN Extensions + * @param orientation orientation. + * @param barcodeHeight bar code height in dots,1~9999. + * @param interpretationLine whether print interpretation line. + * @param aboveCode whether print interpretation line above code. + * @param checkDigit whether print check digit. + * + */ +- (void)BU_BarcodeUPCAWithOrientation:(PTZplOrientation)orientation + barcodeHeight:(NSInteger)barcodeHeight + interpretationLine:(PTZplBool)interpretationLine + aboveCode:(PTZplBool)aboveCode + checkDigit:(PTZplBool)checkDigit; + +#pragma mark ^BY + +/*! + * \~chinese + * + * 设置条码默认值. + * + * @brief 设置条码默认大小、窄宽比 + * @param moduleWidth 模块宽度(点) 1-10 + * @param ratio 窄条宽条比 2.0-3.0 + * @param barcodeHeight 条码高度(点) + * + * \~english + * + * command is used to change the default values for the module width (in dots), the wide bar to narrow bar width ratio and the bar code height (in dots). + * + * @brief change the default values of barcode size and narrow bar width ratio + * @param moduleWidth module width in dots. + * @param ratio wide bar to narrow bar width ratio, 2.0~3.0. + * @param barcodeHeight bar code height in dots. + * + */ +- (void)BY_BarcodeFieldDefaultWithModuleWidth:(NSInteger)moduleWidth + ratio:(float)ratio + barcodeHeight:(NSInteger)barcodeHeight; + +/*! + * \~chinese + * + * 设置条码默认值. + * + * @brief 设置条码默认宽度 + * @param moduleWidth 模块宽度(点) 1-10 + * + * \~english + * + * command is used to change the default values for the module width (in dots), the wide bar to narrow bar width ratio and the bar code height (in dots). + * + * @brief change the default values of module width + * @param moduleWidth module width in dots. + * + */ +- (void)BY_BarcodeFieldDefaultWithModuleWidth:(NSInteger)moduleWidth; + +#pragma mark ^CC + +/*! + * \~chinese + * + * 修改格式指令前缀,默认为字符'^' + * + * @brief 修改格式指令前缀 + * @param character 需要修改的字符,任意ASCII字符 + * + * \~english + * + * change the format command prefix, The default prefix is the caret (^). + * + * @brief change the format command prefix + * @param character character change, any ASCII character is accepted. + * + */ +- (void)CC_ChangeCaret:(NSString *)character; + +#pragma mark ^CD + +/*! + * \~chinese + * + * 修改指令分隔符,默认为字符',' + * + * @brief 修改指令分隔符 + * @param character 需要修改的字符,任意ASCII字符 + * + * \~english + * + * change the delimiter character,The default delimiter is a comma (,). + * + * @brief change the delimiter character + * @param character character change, any ASCII character is accepted. + * + */ +- (void)CD_ChangeDelimiter:(NSString *)charactor; + +#pragma mark ^CF + +/*! + * \~chinese + * + * 更改字母数字默认字体 + * + * @brief 更改字母数字默认字体、大小 + * @param font 默认字体 + * @param width 字符宽度(点) 0~32000 + * @param height 字符高度(点) 0~32000 + * + * \~english + * + * Change Alphanumeric Default Font + * + * @brief change alphanumeric default font and size + * @param font specified default font. + * @param width character width in dots, 0~32000. + * @param height character height in dots, 0~32000. + * + */ +- (void)CF_ChangeDefaultFont:(PTZplFont)font + width:(NSInteger)width + height:(NSInteger)height; + +/*! + * \~chinese + * + * 更改字母数字默认字体 + * + * @brief 更改字母数字默认字体 + * @param font 默认字体 + * + * \~english + * + * Change Alphanumeric Default Font + * + * @brief change alphanumeric default font + * @param font specified default font. + * + */ +- (void)CF_ChangeDefaultFont:(PTZplFont)font; + +/*! + * \~chinese + * + * 更改字母数字默认字体 + * + * @brief 更改字母数字默认字体大小 + * @param width 字符宽度(点) 0~32000 + * @param height 字符高度(点) 0~32000 + * + * \~english + * + * Change Alphanumeric Default Font + * + * @brief change alphanumeric default font size + * @param width character width in dots, 0~32000. + * @param height character height in dots, 0~32000. + * + */ +- (void)CF_ChangeDefaultFontWidth:(NSInteger)width height:(NSInteger)height; +#pragma mark ^CI + +/*! + * \~chinese + * + * 设置要用来进行打印的国际字符集,可以在标签上组合打印不同的字符集。 + * + * @brief 设置字符集 + * @param characterSet 字符集 0-36 亚洲编码:14 + * + * \~english + * + * command enables you to call up the international character set you want to use for printing. You can mix character sets on a label. + * + * @brief set character set + * @param characterSet desired character set, 0-36. + * + */ +- (void)CI_ChangeInternationalCharacterSet:(NSString *)characterSet; + +#pragma mark ^CT + +/*! + * \~chinese + * + * 修改控制指令前缀,默认为字符'~' + * + * @brief 修改控制指令前缀 + * @param character 需要修改的字符,任意ASCII字符 + * + * \~english + * + * change the control command prefix,The default delimiter is a tilde (~). + * + * @brief change the control command prefix + * @param character character change, any ASCII character is accepted. + * + */ +- (void)CT_ChangeTilde:(NSString *)character; + +#pragma mark ^CV + +/*! + * \~chinese + * + * 开关条码验证 + * + * @brief 开关条码验证 + * @param codeValidation 是否开启条码验证 + * + * \~english + * + * acts as a switch to turn the code validation function on or off. + * + * @brief turn the code validation function on or off + * @param codeValidation turn on or off the code validation. + * + */ +- (void)CV_CodeValidation:(PTZplBool)codeValidation; + +#pragma mark ^CW + +/*! + * \~chinese + * + * 修改字体标识符对应的字体 + * + * @brief 修改字体标识符对应的字体 + * @param fontName 需要修改的标识符 + * @param fontDriveLocation 字体存储位置 + * @param downloadedFont 标识符对应的字体名 + * @param extension 字体后缀(FNT,TTF,TTE) + * + * \~english + * + * assigns a single alphanumeric character to a font stored in DRAM, memory card, EPROM, or Flash. + * + * @brief assigns a single alphanumeric character to a font + * @param fontName letter of existing font to be substituted, or new font to be added. + * @param fontDriveLocation device to store font in (optional). + * @param downloadedFont name of the downloaded font to be substituted for the built-in, or as an additional font. + * @param extension extension (FNT,TTF,TTE) + * + */ +- (void)CW_FontIdentifier:(PTZplFont)fontName + fontDriveLocation:(PTZplFileLocation)fontDriveLocation + downloadedFont:(NSString *)downloadedFont + extension:(NSString *)extension; + +#pragma mark ^DF + +/*! + * \~chinese + * + * 保存zpl格式命令 + * + * @brief 保存zpl格式命令 + * @param deviceToStoreImage 存储位置 + * @param imageName 名称 1~8个字母数字字符 + * @param extension 扩展名 (.ZPL) + * + * \~english + * + * command saves ZPL II format commands as text strings. + * + * @brief saves ZPL II format commands + * @param deviceToStoreImage device to store image. + * @param imageName name(1 to 8 alphanumeric characters). + * @param extension extension (.ZPL) + * + */ +- (void)DF_DownloadFormatWithDevice:(PTZplFileLocation)deviceToStoreImage + imageName:(NSString *)imageName + extension:(NSString *)extension; + +#pragma mark ^DG 打印图片 + +/*! + * \~chinese + * + * 保存图片 + * + * @brief 保存图片 + * @param cgImage 图片 + * @param bitmapMode 图片模式 + * @param compress 压缩类型 + * @param deviceLocation 存储位置 + * @param imageName 名称 1~8个字母数字字符 + * @param extension 扩展名 (GRF) + * + * \~english + * + * command downloads an ASCII Hex representation of a graphic image. + * + * @brief downloads a graphic image + * @param cgImage cgImage + * @param bitmapMode simple black and white image or dithering + * @param compress type of data compression + * @param deviceLocation device to store image. + * @param imageName name(1 to 8 alphanumeric characters). + * @param extension extension (GRF) + * + */ +- (void)DG_DownloadGraphicsWithImage:(CGImageRef)cgImage + bitmapMode:(PTBitmapMode)bitmapMode + compress:(PTBitmapCompressMode)compress + deviceLocation:(PTZplFileLocation)deviceLocation + imageName:(NSString *)imageName + extension:(NSString *)extension; + +#pragma mark ^EG + +/*! + * \~chinese + * + * 清除下载的图像 + * @brief 清除下载的图像 + * + * \~english + * + * Erase Download Graphics + * @brief Erase Download Graphics + * + */ +- (void)EG_EraseDownloadGraphics; + +#pragma mark ^FD + +/*! + * \~chinese + * + * 定义打印域的数据字符串,域数据可以是除用作命令前缀(^和 ~)外的任意可打印字符。 + * + * @brief 定义打印内容 + * @param fieldData 用于打印的数据 + * + * \~english + * + * defines the data string for the field. The field data can be any printable character except those used as command prefixes (^ and ~). + * + * @brief defines the data string for the field + * @param fieldData data to be printed. + * + */ +- (void)FD_FieldData:(NSString *)fieldData; + +#pragma mark ^FH + +/*! + * \~chinese + * + * 定义域内十六进制指示符 + * + * @brief 定义十六进制指示符 + * @param hexadecimalIndicator 十六进制指示符 + * + * \~english + * + * define Field Hexadecimal Indicator. + * + * @brief define Field Hexadecimal Indicator + * @param hexadecimalIndicator Field Hexadecimal Indicator. + * + */ +- (void)FH_FieldHexadecimalIndicator:(NSString *)hexadecimalIndicator; + +/*! + * \~chinese + * + * 定义默认的十六进制指示符 '_' + * + * @brief 定义默认的十六进制指示符 + * @param hexadecimalIndicator 十六进制指示符 + * + * \~english + * + * define Field Hexadecimal Indicator '_'. + * + * @brief define Field Hexadecimal Indicator + * @param hexadecimalIndicator Field Hexadecimal Indicator. + * + */ +- (void)FH_FieldHexadecimal; + +#pragma mark ^FN + +/*! + * \~chinese + * + * 字段编号指令. + * + * @brief 带选项的字段编号 + * @param fieldNumber 要分配给字段的编号 + * @param optional 可选参数 + * + * \~english + * + * command numbers the data fields. + * + * @brief numbers the data fields optionally + * @param fieldNumber number to be assigned to the field + * @param optional optional parameter + * + */ +- (void)FN_FieldNumber:(NSInteger)fieldNumber + optional:(NSString *)optional; + +/*! + * \~chinese + * + * 字段编号指令. + * + * @brief 字段编号 + * @param fieldNumber 要分配给字段的编号 + * + * \~english + * + * command numbers the data fields. + * + * @brief command numbers the data fields + * @param fieldNumber number to be assigned to the field. + * + */ +- (void)FN_FieldNumber:(NSInteger)fieldNumber; +#pragma mark ^FO + +/*! + * \~chinese + * + * 设置域相对于标签起始的起始位置 + * + * @brief 设置标签起始位置、对齐方式 + * @param XAxis x轴位置(点) (0~32000) + * @param YAxis y轴位置(点) (0~32000) + * @param justification 对齐方式 + * + * \~english + * + * set a field origin, relative to the label home (LH) position. + * + * @brief set a field origin and justification + * @param XAxis x-axis location in dots. (0~32000) + * @param YAxis x-axis location (in dots). (0~32000) + * @param justification justification. + * + */ +- (void)FO_FieldOriginWithXAxis:(NSInteger)XAxis + YAxis:(NSInteger)YAxis + justification:(PTZplJustification)justification; + +/*! + * \~chinese + * + * 设置域相对于标签起始的起始位置 + * + * @brief 设置标签起始位置 + * @param XAxis x轴位置(点) (0~32000) + * @param YAxis y轴位置(点) (0~32000) + * + * \~english + * + * set a field origin, relative to the label home (LH) position. + * + * @brief set a field origin + * @param XAxis x-axis location in dots. (0~32000) + * @param YAxis x-axis location (in dots). (0~32000) + * + */ +- (void)FO_FieldOriginWithXAxis:(NSInteger)XAxis + YAxis:(NSInteger)YAxis; + +#pragma mark ^FP + +/*! + * \~chinese + * + * 设置字体字段格式,通常用于打印亚洲字体 + * + * @brief 设置文字打印方向 + * @param direction 文字打印方向 + * @param characterGap 字符间附加间距(点) (0~9999) + * + * \~english + * + * set vertical and reverse formatting of the font field, commonly used for printing Asian fonts. + * + * @brief set text print direction + * @param direction print direction. + * @param characterGap additional inter-character gap in dots. (0~9999) + * + */ +- (void)FP_FieldParameterWithDirection:(PTZplTextPrintDirection)direction + characterGap:(NSInteger)characterGap; + +#pragma mark ^FR + +/*! + * \~chinese + * + * 当打印某块域并且已经使用了这个指令,打印输出将会根据背景色进行反转 + * @brief 反转打印 + * + * \~english + * + * When printing a field and the this command has been used, the color of the output is the reverse of its background. + * @brief reverse print + * + */ +- (void)FR_FieldReversePrint; + +#pragma mark ^FS + +/*! + * \~chinese + * + * 添加域分隔符,表示域的定义已经结束 + * @brief 添加域分隔符 + * + * \~english + * + * this command denotes the end of the field definition. + * @brief append field separator + * + */ +- (void)FS_FieldSeparator; + +#pragma mark ^FT + +/*! + * \~chinese + * + * 设置域相对于标签起始的起始位置 + * + * @brief 设置标签起始位置、对齐方式 + * @param XAxis x轴位置(点) (0~32000) + * @param YAxis y轴位置(点) (0~32000) + * @param justification 对齐方式 + * + * \~english + * + * set a field origin, relative to the label home (LH) position. + * + * @brief set a field origin and justification + * @param XAxis x-axis location in dots. (0~32000) + * @param YAxis x-axis location (in dots). (0~32000) + * @param justification justification. + * + */ +- (void)FT_FieldTypesetWithXAxis:(NSInteger)XAxis + YAxis:(NSInteger)YAxis + justification:(PTZplJustification)justification; + +/*! + * \~chinese + * + * 设置域相对于标签起始的起始位置 + * + * @brief 设置标签起始位置 + * @param XAxis x轴位置(点) (0~32000) + * @param YAxis y轴位置(点) (0~32000) + * + * \~english + * + * set a field origin, relative to the label home (LH) position. + * + * @brief set a field origin + * @param XAxis x-axis location in dots. (0~32000) + * @param YAxis x-axis location (in dots). (0~32000) + * + */ +- (void)FT_FieldTypesetWithXAxis:(NSInteger)XAxis + YAxis:(NSInteger)YAxis; + +/*! + * \~chinese + * + * 缺少坐标时,会假定位于上一个已设置格式的字段后面,这一记忆法简化了字段相对于其他字段的位置,在第一个字段定位后,其他字段将自动跟在其后. + * @brief FT_FieldTypeset + * + * \~english + * + * When a coordinate is missing, the position following the last formatted field is assumed.This remembering simplifies field positioning with respect to other fields.Once the first field is positioned, other fields follow automatically. + * @brief FT_FieldTypeset + * + */ +- (void)FT_FieldTypeset; + +#pragma mark ^FV + +/*! + * \~chinese + * + * 当字段为变量时,FV将替换采用标签格式的FD(字段数据)命令内容. + * + * @brief 域变量 + * @param variableFieldDatavariable 变量 + * + * \~english + * + * FV replaces the FD (field data) command in a label format when the field is variable. + * + * @brief field variable + * @param variableFieldData (0~3072 byte string) + * + */ +- (void)FV_FieldVariable:(NSString *)variableFieldData; + +#pragma mark ^FW + +/*! + * \~chinese + * + * 命令用于为所有具有旋转方向的命令字段设置默认方向,还可用于为所有具有对齐参数的命令设置默认对齐方式. + * + * @brief 设置默认朝向、对齐方式 + * @param fieldOrientation 朝向 + * @param justification 对齐方式 + * + * \~english + * + * command sets the default orientation for all command fields that have an orientation (rotation) parameter, + * and sets the default justification for all commands with a justification parameter. + * + * @brief set default orientation and justification + * @param fieldOrientation field orientation. + * @param justification justification. + * + */ +- (void)FW_FieldOrientation:(PTZplOrientation)fieldOrientation + justification:(PTZplJustification)justification; + +/*! + * \~chinese + * + * 用于为所有具有旋转方向的命令字段设置默认方向 + * + * @brief 设置默认朝向 + * @param fieldOrientation 朝向 + * + * \~english + * + * command sets the default orientation for all command fields that have an orientation (rotation) parameter. + * + * @brief set default orientation + * @param fieldOrientation field orientation. + * + */ +- (void)FW_FieldOrientation:(PTZplOrientation)fieldOrientation; + +#pragma mark ^FX + +/*! + * \~chinese + * + * 添加注释 + * + * @brief 添加注释 + * @param comment 注释内容 + * + * \~english + * + * command is useful when you want to add non-printing informational comments or statements within a label format. + * + * @brief comment + * @param comment non printing comment. + * + */ +- (void)FX_FieldComment:(NSString *)comment; + +#pragma mark ^GB + +/*! + * \~chinese + * + * 画线和画框. + * + * @brief 绘制带颜色和圆角的线或框 + * @param width 宽度(点) thickness~32000 + * @param height 高度度(点) thickness~32000 + * @param thickness 厚度(点) 1~32000 + * @param lineColor 线条颜色 + * @param cornorRoundingDegree 圆角程度 0~8 + * + * \~english + * + * draw boxes and lines + * + * @brief draw boxes and lines with color and corner round + * @param width box width in dots. thickness~32000 + * @param height box height in dots. thickness~32000 + * @param thickness border thickness in dots. 1~32000 + * @param lineColor line color. + * @param cornorRoundingDegree degree of corner-rounding. 0~8 + * + */ +- (void)GB_GraphicBoxWithWidth:(NSInteger)width + height:(NSInteger)height + thickness:(NSInteger)thickness + lineColor:(PTZplColor)lineColor + cornorRoundingDegree:(NSInteger)cornorRoundingDegree; + +/*! + * \~chinese + * + * 画线和画框. + * + * @brief 绘制带圆角的线或框 + * @param width 宽度(点) thickness~32000 + * @param height 高度度(点) thickness~32000 + * @param thickness 厚度(点) 1~32000 + * @param cornorRoundingDegree 圆角程度 0~8 + * + * \~english + * + * draw boxes and lines + * + * @brief draw boxes and lines with corner round + * @param width box width in dots. thickness~32000 + * @param height box height in dots. thickness~32000 + * @param thickness border thickness in dots. 1~32000 + * @param cornorRoundingDegree degree of corner-rounding. 0~8 + * + */ +- (void)GB_GraphicBoxWithWidth:(NSInteger)width + height:(NSInteger)height + thickness:(NSInteger)thickness + cornorRoundingDegree:(NSInteger)cornorRoundingDegree; + +/*! + * \~chinese + * + * 画线和画框. + * + * @brief 画线、画框 + * @param width 宽度(点) thickness~32000 + * @param height 高度度(点) thickness~32000 + * @param thickness 厚度(点) 1~32000 + * + * \~english + * + * draw boxes and lines + * + * @brief draw boxes and lines + * @param width box width in dots. thickness~32000 + * @param height box height in dots. thickness~32000 + * @param thickness border thickness in dots. 1~32000 + * + */ +- (void)GB_GraphicBoxWithWidth:(NSInteger)width + height:(NSInteger)height + thickness:(NSInteger)thickness; + +#pragma mark ^GC + +/*! + * \~chinese + * + * 画圆. + * + * @brief 画圆 + * @param diameter 半径(点) 3~4095 + * @param thickness 边框厚度(点) 1~4095 + * @param lineColor 线条颜色 + * + * \~english + * + * draw circle + * + * @brief draw circle + * @param diameter circle diameter in dots. 3~4095 + * @param thickness border thickness in dots. 1~4095 + * @param lineColor line color. + * + */ +- (void)GC_GraphicCircleWithDiameter:(NSInteger)diameter + thickness:(NSInteger)thickness + lineColor:(PTZplColor)lineColor; + +#pragma mark ^GD + +/*! + * \~chinese + * + * 画斜线. + * + * @brief 画斜线 + * @param width 方框宽度(点) thickness~32000 + * @param height 方框高度(点) thickness~32000 + * @param thickness 斜线宽度(点) 1~32000 + * @param lineColor 线条颜色 + * @param orientation 方向 + * + * \~english + * + * draw a straight diagonal line. + * + * @brief draw a straight diagonal line + * @param width box width in dots. thickness~32000 + * @param height box height in dots. thickness~32000 + * @param thickness border thickness in dots. 1~32000 + * @param lineColor line color. + * @param orientation direction of the diagonal. + * + */ +- (void)GD_GraphicDiagonalLineWithWidth:(NSInteger)width + height:(NSInteger)height + thickness:(NSInteger)thickness + lineColor:(PTZplColor)lineColor + orientation:(PTZplDiagonalOrientation)orientation; + +#pragma mark ^GE + +/*! + * \~chinese + * + * 画椭圆. + * + * @brief 画椭圆 + * @param width 椭圆宽度(点) thickness~32000 + * @param height 椭圆高度(点) thickness~32000 + * @param thickness 线条宽度(点) 1~32000 + * @param lineColor 线条颜色 + * + * \~english + * + * draw Ellipse. + * + * @brief draw Ellipse + * @param width Ellipse width in dots. thickness~32000 + * @param height Ellipse height in dots. thickness~32000 + * @param lineColor line color. + * @param orientation direction of the diagonal. + * + */ +- (void)GE_GraphicEllipseWithWidth:(NSInteger)width + height:(NSInteger)height + thickness:(NSInteger)thickness + lineColor:(PTZplColor)lineColor; + + +#pragma mark ^GF + +/*! +* \~chinese +* +* 图片打印 +* +* @brief 图片打印 +* @param compression 压缩类型,一般是字符串B +* @param cgImage 图片 +* @param bitmapMode 图片模式 +* +* \~english +* +* command allows you to download graphic field data directly into the printer’s bitmap storage area. +* +* @brief download graphic field data +* @param compression compression type,default B +* @param cgImage image +* @param bitmapMode image mode. +* +*/ +- (void)GF_GraphicFieldWithCompressionType:(NSString *)compression image:(CGImageRef)cgImage bitmapMode:(PTBitmapMode)bitmapMode; + + +#pragma mark ^GS + +/*! + * \~chinese + * + * 生成注册商标、版权符号和其他符号.使用该指令后,后面紧跟FD命令,通过域数据中的相应字符(A到E)来生成所需符号. + * + * @brief 生成注册商标、版权符号和其他符号 + * @param orientation 朝向 + * @param height 符号宽度(点) 0~32000 + * @param width 符号宽度(点) 0~32000 + * + * \~english + * + * this command enables you to generate the registered trademark, copyright symbol, and other symbols.Use the ^GS command followed by ^FD and the appropriate character (A through E) within the field data to generate the desired character. + * + * @brief generate the registered trademark, copyright symbol, and other symbols + * @param orientation field orientation. + * @param height character height proportional to width (in dots). 0~32000 + * @param width character width proportional to width (in dots). 0~32000 + * + */ +- (void)GS_GraphicSymbolWithOrientation:(PTZplOrientation)orientation + height:(NSInteger)height + width:(NSInteger)width; +/*! + * \~chinese + * + * 生成默认朝向和宽高的符号 + * @brief 生成默认朝向和宽高的符号 + * + * \~english + * + * generate character has default orientation, height and width. + * @brief generate character has default orientation, height and width + * + */ +- (void)GS_GraphicSymbol; + +#pragma mark ^ID + +/*! + * \~chinese + * + * 从存储区域删除对象、图形、字体和已存储的格式. + * + * @brief 删除文件 + * @param objectLocation 存储对象位置 + * @param objectName 对象名称 1~8 characters + * @param extension 扩展名 + * + * \~english + * + * deletes objects, graphics, fonts, and stored formats from storage areas. + * + * @brief deletes file + * @param objectLocation location of stored object + * @param objectName object name. 1~8 characters + * @param extension extension. + * + */ +- (void)ID_ImageDeleteWithObjectLocation:(PTZplFileLocation)objectLocation + objectName:(NSString *)objectName + extension:(NSString *)extension; + +#pragma mark ^IL + +/*! + * \~chinese + * + * 在标签格式的开头加载已存储的某种格式的图像,并将该图像与其他数据进行合并.该图像始终位于FO 0,0. + * + * @brief 加载图像 + * @param objectLocation 存储对象位置 + * @param objectName 对象名称 1~8 characters + * @param extension 扩展名(.GRF,.PNG) + * + * \~english + * + * command is used at the beginning of a label format to load a stored image of a format and merge it with additional data. The image is always positioned at FO 0,0. + * + * @brief load a stored image + * @param objectLocation location of stored object + * @param objectName object name. 1~8 characters + * @param extension extension. (.GRF,.PNG) + * + */ +- (void)IL_ImageLoadWithObjectLocation:(PTZplFileLocation)objectLocation + objectName:(NSString *)objectName + extension:(NSString *)extension; + +#pragma mark ^IM + +/*! + * \~chinese + * + * 将图像从存储区域直接移动到位图中. + * + * @brief 从存储中加载图像 + * @param objectLocation 存储对象位置 + * @param objectName 对象名称 1~8 characters + * @param extension 扩展名(.GRF,.PNG) + * + * \~english + * + * command performs a direct move of an image from storage area into the bitmap. + * + * @brief performs a direct move of an image from storage area into the bitmap + * @param objectLocation location of stored object + * @param objectName object name. 1~8 characters + * @param extension extension. (.GRF,.PNG) + * + */ +- (void)IM_ImageMoveWithObjectLocation:(PTZplFileLocation)objectLocation + objectName:(NSString *)objectName + extension:(NSString *)extension; + +#pragma mark ^IS + +/*! + * \~chinese + * + * 将当前标签保存为图形图像. + * + * @brief 保存当前标签为图像 + * @param objectLocation 存储对象位置 + * @param objectName 对象名称 1~8 characters + * @param extension 扩展名(.GRF,.PNG) + * @param printAfterSorting 是否存储后打印图像 + * + * \~english + * + * command is used within a label format to save that format as a graphic image, + * + * @brief save that format as a graphic image + * @param objectLocation location of stored object + * @param objectName object name. 1~8 characters + * @param extension extension. (.GRF,.PNG) + * @param printAfterSorting whether print image after storing. + * + */ +- (void)IS_ImageSaveWithObjectLocation:(PTZplFileLocation)objectLocation + objectName:(NSString *)objectName + extension:(NSString *)extension + printAfterSorting:(PTZplBool)printAfterSorting; + +#pragma mark ~JA + +/*! + * \~chinese + * + * 取消缓冲区中所有格式命令. + * @brief 取消格式命令 + * + * \~english + * + * cancels all format commands in the buffer. + * @brief cancels all format commands in the buffer + * + */ +- (void)JA_CancelAll; + +#pragma mark ~JD + +/*! + * \~chinese + * + * 启用通讯诊断 + * @brief 启用通讯诊断 + * @note 启动诊断模式,为打印机接收的所有字符生成ASCII打印结果(使用打印机的当前标签长度和全宽).该打印结果包括ASCII字符、十六进制值和任何通信错误。 + * + * \~english + * + * initiates Diagnostic Mode. + * @brief initiates Diagnostic Mode + * @note command initiates Diagnostic Mode, which produces an ASCII printout (using current label length and full width of printer) of all characters received by the printer. This printout includes the ASCII characters, the hexadecimal value, and any communication errors. + * + */ +- (void)JD_EnableCommunicationsDiagnostics; + +#pragma mark ~JE + +/*! + * \~chinese + * + * 关闭通讯诊断 + * @brief 关闭通讯诊断 + * + * \~english + * + * Disable Diagnostics + * @brief Disable Diagnostics + * + */ +- (void)JE_DisableDiagnostics; + +#pragma mark ^JZ + +/*! + * \~chinese + * + * 是否打印出错后重新打印 + * + * @brief 打印出错后重新打印开关 + * @note 命令用于重新打印由于碳带用完、介质用完或打印头开启等错误状况而部分打印的标签.错误状况得到解决后,会立即重新打印标签.在向打印机发送另一个 ^JZ 命令或关闭打印机之前,此命令将一直有效。 + * + * \~english + * + * whether reprint after error. + * + * @brief whether reprint after error + * @note reprints a partially printed label caused by a Ribbon Out, Media Out, or Head Open error condition. The label is reprinted as soon as the error condition is corrected. This command remains active until another ^JZ command is sent to the printer or the printer is turned off. + * + */ +- (void)JZ_SetReprintAfterError:(PTZplBool)enable; + +#pragma mark ^LH + +/*! + * \~chinese + * + * 设置标签起始位置. + * + * @brief 标签起始位置 + * @param XPos x轴位置(点) (0~32000) + * @param YPos y轴位置(点) (0~32000) + * + * \~english + * + * sets the label home position. + * + * @brief sets the label home position + * @param XPos x-axis position in dots. (0~32000) + * @param YPos y-axis position in dots. (0~32000) + * + */ +- (void)LH_LabelHomeWithXPos:(NSInteger)XPos + YPos:(NSInteger)YPos; + +#pragma mark ^LL + +/*! + * \~chinese + * + * 定义标签长度. + * + * @brief 标签长度 + * @param length 标签长度(点) + * + * \~english + * + * defines the length of the label. + * + * @brief defines the length of the label + * @param length the length of the label. + * + */ +- (void)LL_LabelLength:(NSInteger)length; + +#pragma mark ^LR + +/*! + * \~chinese + * + * 是否开启标签反色打印.用于反色打印标签格式中的所有字段. + * + * @brief 开关反色打印 + * @param reverse 是否开启 + * + * \~english + * + * reverse the printing of all fields in the label format. + * + * @brief trun on/off color reverse print + * @param reverse whether reverse print all fields. + * + */ +- (void)LR_LabelReversePrint:(PTZplBool)reverse; + +#pragma mark ^LS + +/*! + * \~chinese + * + * 此命令用于将 所有字段的位置向左移动. + * + * @brief 内容左移 + * @param shift 移动点数. + * + * \~english + * + * shift all field positions to the left. + * + * @brief shift all field positions to the left + * @param shift shift left value in dots. + * + */ +- (void)LS_LabelShift:(NSInteger)shift; + +#pragma mark ^LT + +/*! + * \~chinese + * + * 用于将整个标签格式从其当前位置向上或向下移动最多120点行(相对于标签顶部边缘). + * + * @brief 上下移动标签 + * @param top 移动点数(-120~120). + * + * \~english + * + * command moves the entire label format a maximum of 120 dot rows up or down from its current position, in relation to the top edge of the label. + * + * @brief moves the entire label format + * @param top label top (in dot rows) -120~120. + * + */ +- (void)LT_LabelTop:(NSInteger)top; + +#pragma mark ^MC + +/*! + * \~chinese + * + * 在正常操作中,会在打印格式后清除位图.MC命令用于决定是否保留当前位图,这适用于当前标签和后续标签,直到使用该命令进行清除。 + * + * @brief 是否清除位图 + * @param clear 是否清除 + * + * \~english + * + * In normal operation, the bitmap is cleared after the format has been printed. The command with false is used to retain the current bitmap. This applies to current and subsequent labels until cleared with true. + * + * @brief retain the current bitmap + * @param clear whether clear bitmap. + * + */ +- (void)MC_MapClear:(PTZplBool)clear; + +#pragma mark ^ML + +/*! + * \~chinese + * + * 设置最大标签长度. + * + * @brief 最大标签长度 + * @param length 标签长度 + * + * \~english + * + * let you adjust the maximum label length. + * + * @brief set the maximum label length + * @param length maximum label length. + * + */ +- (void)ML_MaximumLabelLength:(NSInteger)length; + +#pragma mark ^MT + +/*! + * \~chinese + * + * 设置介质类型. + * + * @brief 介质类型 + * @param type 介质类型 + * + * \~english + * + * select the type of media being used in the printer. + * + * @brief set type of media + * @param type media type used. + * + */ +- (void)MT_SetMediaType:(PTZplMediaType)type; + +#pragma mark ^ND + +/*! + * \~chinese + * + * 设置网络. + * + * @brief 网络 + * @param ipAddress ip地址 + * @param subnetMask 子网掩码 + * + * \~english + * + * change network settings. + * + * @brief change network settings + * @param ipAddress IP address. + * @param subnetMask subnet mask. + * + */ +- (void)ND_SetNetworkSettingWithIP:(NSString *)ipAddress + SubnetMask:(NSString *)subnetMask; + +#pragma mark ^PM + +/*! + * \~chinese + * + * 开关镜像打印.打印效果为左右翻转图像. + * + * @brief 开关镜像打印 + * @param mirror 是否开启 + * + * \~english + * + * prints the entire printable area of the label as a mirror image. This command flips the image from left to right. + * + * @brief turn on/off mirrir print + * @param mirror media type used. + * + */ +- (void)PM_PrintLabelMirrorImage:(PTZplBool)mirror; + +#pragma mark ^PO + +/*! + * \~chinese + * + * 设置打印方向 + * + * @brief 打印方向 + * @param orientation 打印方向 + * + * \~english + * + * setting print orientation. + * + * @brief setting print orientation + * @param orientation print orientation. + * + */ +- (void)PO_PrintOrientation:(PTZplPrintOrientation)orientation; + +#pragma mark ^PP ~PP +/*! + * \~chinese + * + * 用于在当前标签完成后(如果正在打印)停止打印,并将打印机置于暂停模式. + * @brief 打印完成后停止打印 + * + * \~english + * + * command stops printing after the current label is complete (if one is printing) and places the printer in Pause Mode. + * @brief stops printing after the current label is complete + * + */ +- (void)PP_ProgrammablePause; + +#pragma mark ^PQ + +/*! + * \~chinese + * + * 控制几项打印操作。此命令会控制要打印的标签数量、打印机暂 停前打印的标签数量,以及每个序列号的副本数量. + * + * @brief 打印操作控制 + * @param quantity 打印份数 + * @param pauseValue 暂停和切纸值(暂停区间打印的标签数) + * @param replicateValue 每个序列号的份数 + * @param overrided Y->打印机切纸,不暂停;N->暂停,不切纸 + * + * \~english + * + * Controls several printing operations. This command controls the number of labels to print, the number of labels to print before the printer is paused, and the number of copies of each serial number. + * + * @brief gives control over several printing operations + * @param quantity total quantity of labels to print. + * @param pauseValue pause and cut value (labels between pauses). + * @param replicateValue replicates of each serial number. + * @param overrided Y:printer cutting paper without pause; N:pause, don't cut the paper + * + */ +- (void)PQ_PrintQuantity:(NSInteger)quantity + pauseValue:(NSInteger)pauseValue + replicateValue:(NSInteger)replicateValue + overrided:(PTZplBool)overrided; + +/*! + * \~chinese + * + * 设置标签打印份数. + * + * @brief 设置标签打印份数 + * @param quantity 打印份数 + * + * \~english + * + * total quantity of labels to print + * + * @brief set print quantity + * @param quantity total quantity of labels to print. + * + */ +- (void)PQ_PrintQuantity:(NSInteger)quantity; + +#pragma mark ^PW + +/*! + * \~chinese + * + * 设置标签宽度. + * + * @brief 设置标签宽度 + * @param width 标签宽度(点) + * + * \~english + * + * set the print width. + * + * @brief set the print width + * @param width label width in dots. + * + */ +- (void)PW_PrintWidth:(NSInteger)width; + +#pragma mark ^SC + +/*! + * \~chinese + * + * 串口通信设置. + * + * @brief 串口通信设置 + * @param baudRate 波特率 + * @param dataBits 字长 7或8 + * @param parity 奇偶校检 N(无)、E(偶数)或O(奇数) + * @param stopBits 停止位 1或2 + * @param protocolMode 协议模式 + * + * \~english + * + * change the serial communications parameters you are using. + * + * @brief change the serial communications parameters + * @param baudRate baud rate + * @param dataBits word length, 7 or 8. + * @param parity parity, N(none), E(even), orO(odd). + * @param stopBits stop bits, 1 or 2. + * @param protocolMode protocol mode. + * + */ +- (void)SC_SetSerialCommunicationsWithBaudRate:(NSString *)baudRate + DataBits:(NSString *)dataBits + Parity:(NSString *)parity + StopBits:(NSString *)stopBits + ProtocolMode:(NSString *)protocolMode; + +#pragma mark ~SD + +/*! + * \~chinese + * + * 设置打印暗度. + * + * @brief 设置打印暗度 + * @param darkness 暗度 0~30 + * + * \~english + * + * set the darkness of printing. + * + * @brief set the darkness of printing + * @param darkness darkness 0~30. + * + */ +- (void)SD_SetDarkness:(NSInteger)darkness; + +#pragma mark ^SF + +/*! + * \~chinese + * + * 与FD指令生成连续域 + * + * @brief 连续域 + * @note 掩码字符串占位符: D或d -> 十进制0–9; H或h -> 十六进制0–9和a-f或A-F; O或o –> 八进制0–7; A或a –> 字母A–Z或a–z; N或n –> 字母数字0–9和A–Z或a–z; % –> 忽略字符或跳过. + * @param maskString 掩码 + * @param incrementString 递增量 + * + * \~english + * + * serialization field (with a standard ^FD string). + * + * @brief serialization field + * @note Mask String placeholders: D or d –> Decimal numeric 0–9; H or h –> Hexadecimal 0–9 plus a-f or A-F; O or o –> Octal 0–7; A or a –> Alphabetic A–Z or a–z; N or n –> Alphanumeric 0–9 plus A–Z or a–z; % –> Ignore character or skip. + * @param maskString mask string. + * @param incrementString increment string. + * + */ +- (void)SF_SerializationFieldWithMaskString:(NSString *)maskString + incrementString:(NSString *)incrementString; + +#pragma mark ^TO + +/*! + * \~chinese + * + * 对象复制. + * + * @brief 对象复制 + * @param sourceDevice 复制对象存储对象位置 + * @param sourceObjectName 复制对象名称 1~8 characters + * @param sourceExtension 复制对象后缀 + * @param destinationDevice 目标对象位置 + * @param destinationObjectName 目标对象名称 1~8 characters + * @param destinationExtension 目标对象后缀 + * + * \~english + * + * command is used to copy an object or group of objects from one storage device to another. + * + * @brief copy an object + * @param sourceDevice source device of stored object. + * @param sourceObjectName stored object name. 1~8 characters. + * @param sourceExtension source object extension. + * @param destinationDevice destination device of stored object. + * @param destinationObjectName destination object name. 1~8 characters. + * @param destinationExtension destination object extension. + * + */ +- (void)TO_TransferObjectWithSourceDevice:(PTZplFileLocation)sourceDevice + sourceObjectName:(NSString *)sourceObjectName + sourceExtension:(NSString *)sourceExtension + destinationDevice:(PTZplFileLocation)destinationDevice + destinationObjectName:(NSString *)destinationObjectName + destinationExtension:(NSString *)destinationExtension; + +#pragma mark ^XA + +/*! + * \~chinese + * + * 开始新的标签格式 + * @brief 开启标签格式 + * + * \~english + * + * open bracket and indicates the start of a new label format. + * @brief start a new label format + * + */ +- (void)XA_FormatStart; + +#pragma mark ^XF + +/*! + * \~chinese + * + * 根据位置、全名调用要进行打印的图形图像. + * + * @brief XF_RecallFormat + * @param sourceDevice 存储对象位置 + * @param imageName 对象名称 1~8 characters + * @param extension .GRF + * @param XAxisMagnification x轴放大系数 1~10 + * @param YAxisMagnification y轴放大系数 1~10 + * + * \~english + * + * command recalls a stored format to be merged with variable data. + * + * @brief XF_RecallFormat + * @param sourceDevice location of stored object + * @param imageName object name. 1~8 characters + * @param extension .GRF + * @param XAxisMagnification magnification factor on the x-axis. 1~10 + * @param YAxisMagnification magnification factor on the y-axis. 1~10 + * + */ +- (void)XF_RecallFormatWithSourceDevice:(PTZplFileLocation)sourceDevice + imageName:(NSString *)imageName + extension:(NSString *)extension; + +#pragma mark ^XG + +/*! + * \~chinese + * + * 根据位置、全名调用要进行打印的图形图像. + * + * @brief XG_RecallGraphic + * @param sourceDevice 存储对象位置 + * @param imageName 对象名称 1~8 characters + * @param extension .GRF + * @param XAxisMagnification x轴放大系数 1~10 + * @param YAxisMagnification y轴放大系数 1~10 + * + * \~english + * + * command is used to recall one or more graphic images for printing. + * + * @brief XG_RecallGraphic + * @param sourceDevice location of stored object + * @param imageName object name. 1~8 characters + * @param extension .GRF + * @param XAxisMagnification magnification factor on the x-axis. 1~10 + * @param YAxisMagnification magnification factor on the y-axis. 1~10 + * + */ +- (void)XG_RecallGraphicWithSourceDevice:(PTZplFileLocation)sourceDevice + imageName:(NSString *)imageName + extension:(NSString *)extension + XAxisMagnification:(NSInteger)XAxisMagnification + YAxisMagnification:(NSInteger)YAxisMagnification; + +#pragma mark ^XZ + +/*! + * \~chinese + * + * 结束标签格式 + * @brief 结束标签格式 + * + * \~english + * + * indicates the end of a label format. + * @brief end a label format + * + */ +- (void)XZ_FormatEnd; + +#pragma mark ^PR + +/*! + * \~chinese + * + * 设置打印期间的一些速度参数. + * + * @brief 打印速度设置 + * @param speed 打印速度(英寸每秒) 1~14 + * @param slewSpeed 空甩速度(英寸每秒) 2~14 + * @param backfeedSpeed 回撤速度(英寸每秒) 2~14 + * + * \~english + * + * determine the media and slew speed (feeding a blank label) during printing. + * + * @brief set speed during printing + * @param speed print speed (inch per second). 1~14 + * @param slewSpeed slew speed (inch per second). 2~14 + * @param backfeedSpeed backfeed speed (inch per second). 2~14 + * + */ +- (void)PR_SetSpeed:(NSInteger)speed + slewSpeed:(NSInteger)slewSpeed + backfeedSpeed:(NSInteger)backfeedSpeed; + +#pragma mark ^MM 打印模式 +/*! + * \~chinese + * + * 确定打印机在打印一个标签或一组标签之后采取的操作. + * + * @brief 打印模式设置 + * @param mode 所需的模式 + * @param preStripping 预剥离选择,默认是N + * + * \~english + * + * determine the action the printer takes after printing a label or a set of labels. + * + * @brief Set print mode + * @param mode print mode + * @param preStripping prestripping option,defalut is N + * + */ +- (void)MM_SetPrintMode:(PTZplPrintMode)mode + preStripping:(PTZplBool)preStripping; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTDispatcher.h b/ios/frameworks/PrinterSDK.framework/Headers/PTDispatcher.h new file mode 100644 index 0000000..adcb160 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTDispatcher.h @@ -0,0 +1,217 @@ +/*! + * \~chinese + * @header PTDispatcher.h + * @abstract 通讯协议 + * + * \~english + * @header PTDispatcher.h + * @abstract Protocol + */ + +#import +#import +#import "SDKDefine.h" +#import "PTPrinter.h" + + +/// 连接模式 +typedef NS_ENUM(NSInteger, PTDispatchMode) { + + /// 未知类型 + PTDispatchModeUnconnect = 0, + + /// 蓝牙 + PTDispatchModeBLE = 1, + + /// 无线 + PTDispatchModeWiFi = 2 +}; + +/// 手机蓝牙状态 +typedef NS_ENUM(NSInteger, PTBluetoothState) { + /// 未授权,请前往系统设置授权 + PTBluetoothStateUnauthorized = 0, + /// 蓝牙未开 + PTBluetoothStatePoweredOff = 1, + /// 正常 + PTBluetoothStatePoweredOn = 2, +}; + +/// 打印完成后打印机返回的状态 +typedef NS_ENUM(NSInteger, PTPrintState) { + + /// 打印成功 + PTPrintStateSuccess = 0xcc00, + + /// 打印失败(缺纸) + PTPrintStateFailurePaperEmpty = 0xcc01, + + /// 打印失败(开盖) + PTPrintStateFailureLidOpen = 0xcc02 +}; + +/// 返回连接的错误类型 +typedef NS_ENUM(NSInteger, PTConnectError) { + + /// 连接超时 + PTConnectErrorBleTimeout = 0, + + /// 获取服务超时 + PTConnectErrorBleDisvocerServiceTimeout = 1, + + /// 验证超时 + PTConnectErrorBleValidateTimeout = 2, + + /// 未知设备 + PTConnectErrorBleUnknownDevice = 3, + + /// 系统错误,由coreBluetooth框架返回 + PTConnectErrorBleSystem = 4, + + /// 验证失败 + PTConnectErrorBleValidateFail = 5, + + /// 无线连接超时 + PTConnectErrorWifiTimeout = 6, + + /// socket错误 + PTConnectErrorWifiSocketError = 7 +}; + +/// 返回固件升级错误 +typedef NS_ENUM(NSInteger, PTUpgradeFirmwareState) { + + /// 升级成功 + PTUpgradeFirmwareStateSuccess = 0, + + /// 升级失败,数据长度错误 + PTUpgradeFirmwareStateFailureDataLengthError, + + /// 升级失败,验证或者校验失败 + PTUpgradeFirmwareStateFailureValidateFail, + + /// 升级失败,写入超时 + PTUpgradeFirmwareStateFailureWriteTimout, + + /// 升级失败,包序号错误 + PTUpgradeFirmwareStateFailurePackageNumberError, + + /// 升级失败,包长度错误 + PTUpgradeFirmwareStateFailurePackageLengthError, + + /// 升级失败,写入失败 + PTUpgradeFirmwareStateFailureWriteFail, + + /// 升级失败 + PTUpgradeFirmwareStateFail +}; + +@class PTPrinter; + +typedef void(^PTPrinterMutableArrayBlock)(NSMutableArray *printerArray); +typedef void(^PTEmptyParameterBlock)(void); +typedef void(^PTBluetoothConnectFailBlock)(PTConnectError error); +typedef void(^PTNumberParameterBlock)(NSNumber *number); +typedef void(^PTDataParameterBlock)(NSData *data); +typedef void(^PTPrintStateBlock)(PTPrintState state); +typedef BOOL(^PTPeripheralFilterBlock)(CBPeripheral *peripheral, NSDictionary *advertisementData, NSNumber *RSSI); +typedef void(^PTUnconnectBlock)(NSNumber *number, BOOL isActive); +typedef void(^PTSendSuccessParameterBlock)(int64_t dataCount, double time); +typedef void(^PTUpgradeFirmwareStateBlock)(PTUpgradeFirmwareState state); + +@interface PTDispatcher : NSObject + +@property (assign, nonatomic) PTDispatchMode mode; +@property (strong, nonatomic, readwrite) PTPrinter *printerConnected; //该属性表示连接后的打印机对象 +@property (copy, nonatomic, readwrite) PTSendSuccessParameterBlock sendSuccessBlock; +@property (copy, nonatomic, readwrite) PTEmptyParameterBlock sendFailureBlock; +@property (copy, nonatomic, readwrite) PTNumberParameterBlock sendProgressBlock; +@property (copy, nonatomic, readwrite) PTDataParameterBlock receiveDataBlock; +@property (copy, nonatomic, readwrite) PTPrintStateBlock printStateBlock; +@property (copy, nonatomic, readwrite) PTPrinterMutableArrayBlock findAllPeripheralBlock; +@property (copy, nonatomic, readwrite) PTEmptyParameterBlock connectSuccessBlock; +@property (copy, nonatomic, readwrite) PTBluetoothConnectFailBlock connectFailBlock; +@property (copy, nonatomic, readwrite) PTUnconnectBlock unconnectBlock; +@property (copy, nonatomic, readwrite) PTNumberParameterBlock readRSSIBlock; +@property (copy, nonatomic, readwrite) PTPeripheralFilterBlock peripheralFilterBlock; +@property (copy, nonatomic, readwrite) PTUpgradeFirmwareStateBlock upgradeFirmwareStateBlock; + +/// 创建单例对象 ++ (instancetype)share; + +/// 发送数据 +- (void)sendData:(NSData *)data; + +/// 暂停发送 +- (void)pauseWriteData; + +/// 继续发送 +- (void)resumeWriteData; + +/// 开始扫描蓝牙 +- (void)scanBluetooth; + +/// 停止扫描蓝牙,连接成功后SDK会自动停止扫描 +- (void)stopScanBluetooth; + +/// 扫描Wi-Fi wifi的端口是9100, 如果需要获得路由的名称以及mac地址信息, ios12+需要Access WiFi Information的权限,iOS13+以后要开启定位权限 +- (void)scanWiFi:(PTPrinterMutableArrayBlock)wifiAllBlock; + +/// 获取已发现的所有打印机 +- (void)whenFindAllBluetooth:(PTPrinterMutableArrayBlock)bluetoothBlock; + +/// 获取蓝牙的rssi信号强度 +- (void)whenReadRSSI:(PTNumberParameterBlock)readRSSIBlock; + +/// 连接打印机,传入的是打印机对象 +- (void)connectPrinter:(PTPrinter *)printer; + +/// 断开打印机连接 +- (void)unconnectPrinter:(PTPrinter *)printer; + +/// 连接成功回调,连接成功后,会停止扫码设备 +- (void)whenConnectSuccess:(PTEmptyParameterBlock)connectSuccessBlock; + +/// 连接失败的回调 +- (void)whenConnectFailureWithErrorBlock:(PTBluetoothConnectFailBlock)connectFailBlock; + +/// 断开连接的回调,调用unconnectPrinter断开打印机后,会调用该方法 +- (void)whenUnconnect:(PTUnconnectBlock)unconnectBlock; + +/// 数据发送成功的回调,数据发送完成后,会调用该方法 +- (void)whenSendSuccess:(PTSendSuccessParameterBlock)sendSuccessBlock; + +/// 数据发送失败的回调 +- (void)whenSendFailure:(PTEmptyParameterBlock)sendFailureBlock; + +/// 数据发送进度的回调 +- (void)whenSendProgressUpdate:(PTNumberParameterBlock)sendProgressBlock; + +/// 接收到打印机返回的数据,比如获取打印机名称就是通过该方法返回 +- (void)whenReceiveData:(PTDataParameterBlock)receiveDataBlock; + +/// 接收到打印机打印状态回调,使用该方法前,需要保证打印机打开了状态回调的开关,比如CPCL指令集中的cpclTurnOnPrintStatusCallBack方法,ESC中的turnOnPrintStatusCallBack方法 +- (void)whenUpdatePrintState:(PTPrintStateBlock)printStateBlock; + +/// 设置蓝牙连接超时时间 +- (void)setupBleConnectTimeout:(double)timeout; + +/// 设置外设过滤,在发现打印机设备的回调中进行一些过滤,返回自己想要的机型 +- (void)setupPeripheralFilter:(PTPeripheralFilterBlock)block; + +/// 注册蓝牙中心,该接口用于兼容你自己实现的CoreBluetooth框架 +- (void)registerCentralManager:(CBCentralManager *)manager delegate:(id)delegate; + +/// 注销代理 +- (void)unregisterDelegate; + +/// 升级固件状态回调 +- (void)whenUpgradeFirmwareStateBlock:(PTUpgradeFirmwareStateBlock)upgradeFirmwareStateBlock; + +/// 手机的蓝牙状态,为了准确获取手机蓝牙状态,需要在app启动的时候初始化PTDispatcher +- (PTBluetoothState)getBluetoothStatus; + +/// SDK打包时间 +- (NSString *)SDKBuildTime; + +@end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTEncode.h b/ios/frameworks/PrinterSDK.framework/Headers/PTEncode.h new file mode 100644 index 0000000..0354b08 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTEncode.h @@ -0,0 +1,88 @@ +/*! + * \~chinese + * @header PTEncode.h + * @abstract 编码与解码 + * + * \~english + * @header PTEncode.h + * @abstract Coding and decoding + */ + +#import + +@interface PTEncode : NSObject + + +/*! + * \~chinese + * 编码,默认是GBK + * + * @param string 需要编码的字符串 + * + * @return 编码后的数据 + * + * \~english + * Encode,default:GBK + * + * @param string String to be encoded + * + * @return Encoded data + */ ++ (NSData *)encodeDataWithString:(NSString *)string; + +/*! + * \~chinese + * 解码,default:GBK + * + * @param data 需要解码的数据 + * + * @return 解码后的字符串 + * + * \~english + * Decoding,default:GBK + * + * @param data Data to be decoded + * + * @return Decoded data + */ ++ (NSString *)decodeStringWithData:(NSData *)data; + +/*! + * \~chinese + * 支持多种编码 + * + * @param string 需要编码的字符串 + * @param encodeType 编码类型 + * + * @return 编码后的数据 + * + * \~english + * Support various encoding. + * + * @param string String to be encoded + * @param encodeType Encode type + * + * @return Encoded data + */ ++ (NSData *)encodeDataWithString:(NSString *)string encodingType:(CFStringEncodings)encodeType; + +/*! + * \~chinese + * 支持多种解码 + * + * @param data 需要解码的数据 + * @param encodeType 编码类型 + * + * @return 解码后的字符串 + * + * \~english + * Support various decoding. + * + * @param data Data to be decoded + * @param encodeType Encode type + * + * @return Decoded data + */ ++ (NSString *)decodeDataWithString:(NSData *)data encodingType:(CFStringEncodings)encodeType; + +@end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTLabel.h b/ios/frameworks/PrinterSDK.framework/Headers/PTLabel.h new file mode 100644 index 0000000..2e34a15 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTLabel.h @@ -0,0 +1,231 @@ +/*! + * \~chinese + * @header PTLabel.h + * @abstract 快递模板 + * + * \~english + * @header PTLabel.h + * @abstract Express template + */ + +#import + + +/*! + * \~chinese + * @brief 使用电子面单模板,只需要填充相应的表单数据,即可发送打印出一张面单。注意: 1.当使用模板打印时,您必须填充我们提供的模板使用范例中所填充的所有表单项。2. 如果有空数据项,比如申明价值为空,则传入@""空字符串。3.不同的模板,所要填充的数据项是不同的,具体以我们的范例为准。 + * + * \~english + * @brief By using electronic waybill template, only filling in it accordingly can send and print it out。Note: 1. When using template to print, you should fill in all the blanks as the template sample showed.2.If there is null data, e.g. claiming value is null, please input null character string @"".3.The data to fill in differs depending on the template, please subject to the sample showed. + */ + +@interface PTLabel : NSObject + +/*! + * \~chinese + * 快递公司 + * + * \~english + * Express company + */ +@property(strong,nonatomic,readwrite) NSString *express_company; + +/*! + * \~chinese + * 运单号 + * + * \~english + * Delivery number + */ +@property(strong,nonatomic,readwrite) NSString *delivery_number; + +/*! + * \~chinese + * 订单号 + * + * \~english + * Order number + */ +@property(strong,nonatomic,readwrite) NSString *order_number; + +/*! + * \~chinese + * 集散地 + * + * \~english + * Distributing + */ +@property(strong,nonatomic,readwrite) NSString *distributing; + +/*! + * \~chinese + * 条形码 + * + * \~english + * Barcode + */ +@property(strong,nonatomic,readwrite) NSString *barcode; + +/*! + * \~chinese + * 条形码下方的字符 + * + * \~english + * The character below the bar code + */ +@property(strong,nonatomic,readwrite) NSString *barcode_text; + +/*! + * \~chinese + * 二维码 + * + * \~english + * QRcode + */ +@property(strong,nonatomic,readwrite) NSString *qrcode; + +/*! + * \~chinese + * 二维码下方的字符 + * + * \~english + * The character below the QR code + */ +@property(strong,nonatomic,readwrite) NSString *qrcode_text; + +/*! + * \~chinese + * 收件人 名字 + * + * \~english + * Recipient name + */ +@property(strong,nonatomic,readwrite) NSString *receiver_name; + +/*! + * \~chinese + * 收件人 电话 + * + * \~english + * Recipient phone + */ +@property(strong,nonatomic,readwrite) NSString *receiver_phone; + +/*! + * \~chinese + * 收件人 地址 + * + * \~english + * Recipient address + */ +@property(strong,nonatomic,readwrite) NSString *receiver_address; + +/*! + * \~chinese + * 收件人 信息 + * + * \~english + * Recipient Information + */ +@property(strong,nonatomic,readwrite) NSString *receiver_message; + +/*! + * \~chinese + * 发件人 名字 + * + * \~english + * Sender name + */ +@property(strong,nonatomic,readwrite) NSString *sender_name; + +/*! + * \~chinese + * 发件人 电话 + * + * \~english + * Sender phone + */ +@property(strong,nonatomic,readwrite) NSString *sender_phone; + +/*! + * \~chinese + * 发件人 地址 + * + * \~english + * Sender address + */ +@property(strong,nonatomic,readwrite) NSString *sender_address; + +/*! + * \~chinese + * 发件人 信息 + * + * \~english + * Sender information + */ +@property(strong,nonatomic,readwrite) NSString *sender_message; + +/*! + * \~chinese + * 物品名 + * + * \~english + * Item name + */ +@property(strong,nonatomic,readwrite) NSString *article_name; + +/*! + * \~chinese + * 物品重量 + * + * \~english + * Item weight + */ +@property(strong,nonatomic,readwrite) NSString *article_weight; + +/*! + * \~chinese + * 申明价值 + * + * \~english + * Affirmation value + */ +@property(strong,nonatomic,readwrite) NSString *amount_declare; + +/*! + * \~chinese + * 到付金额 + * + * \~english + * Payment amount + */ +@property(strong,nonatomic,readwrite) NSString *amount_paid; + +/*! + * \~chinese + * 预付金额 + * + * \~english + * Prepayment amount + */ +@property(strong,nonatomic,readwrite) NSString *amount_paid_advance; + +/// 由模板数据生成下发给打印机的数据 +/// @param filePath 模板路径 +- (NSData *)dataWithSourceFile:(NSString *)filePath; + +/// 生成TSPL指令的数据 +- (NSData *)dataWithTSPL; + +/// 由模板数据生成下发给打印机的数据 +/// @param source 资源 +/// @param labelDict 模板定义的key +/// @param orderDetails 订单详情 +- (NSData *)getTemplateData:(NSString *)source labelDict:(NSDictionary *)labelDict orderDetails:(NSArray *)orderDetails; + +/// 由模板数据生成下发给打印机的数据 +/// @param source 资源 +/// @param labelDict 模板定义的key +- (NSData *)getTemplateData:(NSString *)source labelDict:(NSDictionary *)labelDict; + +@end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTOldCommandCPCL.h b/ios/frameworks/PrinterSDK.framework/Headers/PTOldCommandCPCL.h new file mode 100644 index 0000000..c88536b --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTOldCommandCPCL.h @@ -0,0 +1,632 @@ + + +/*! + * \~chinese + * 该类是SDK3.0.0之前的版本,由于很多客户还是使用之前的SDK,优化接口后改动太大,就用一个类保留之前的接口 + * + * \~english + * This class is a version before SDK3.0.0. Since many customers still use the previous SDK, after optimizing the interface and making too much change, use a class to retain the previous interface. + */ + + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PTOldCommandCPCL : NSObject + +@property(strong,nonatomic,readwrite) NSMutableData * _Nonnull cmdData; + +@property (nonatomic, assign) NSStringEncoding encoding; + +- (void)appendCommand:(NSString * _Nonnull)cmd; + +- (void)appendCommandData:(NSData * _Nonnull)data; + +/** + 打印机自检页 selfTest + */ +- (void)printSelfInspectionPage; + +/** + 获取打印机状态 get printer status. + */ +- (void)cpclGetPaperStatus; + +/** + 开关打印状态回调 + turn on/off print status callback. + + @param flag on/off + */ +- (void)cpclTurnOnPrintStatusCallBack:(BOOL)flag; + +/** + 打开下划线 + Turn on underline + */ +- (void)cpclUnderlineON; + +/** + 关闭下划线 + Turn off underline + */ +- (void)cpclUnderlineOFF; +- (void)cpclUtilitySession; + +/** 行模式指令前缀 Command prefix of line mode */ +- (void)cpclLineMode; +- (void)cpclReWindOFF; + +/** + 获取打印机SN号 get printer serial number. + */ +- (void)cpclGetPrinterSN; + +/** + * 设置纸张类型1 Set the paper type + * + * @param type (0~5) + 0:连续纸 continuous paper + 1:标签纸 Label paper + 2:后黑标 Back black mark + 3:前黑标 Front black mark + 4:3寸黑标 3 inch black mark + 5:2寸黑标 2 inch black mark + */ +- (void)cpclPaperTypeWithType:(NSInteger )type; + +/** + * 设置纸张类型2 Set the paper type + * + * @param type (0~5) + 0:连续纸 continuous paper + 2:标签纸 Label paper + 4:2寸黑标 2 inch black mark + 5:3寸黑标 3 inch black mark + 6:4寸黑标 4 inch black mark + */ +- (void)setPrinterPaperTypeFor4Inch:(NSInteger)type; + + +/** + Set Label + + @param offset The number of units to offset all fields from the left side of the label horizontally. 0-65535 + @param hRes The horizontal resolution of this label, expressed in dots per inch. 100 or 200 + @param vRes The vertical resolution of this label, expressed in dots per inch. 100 or 200 + @param height The height of the label in units. 0-65535 + @param quantity The number of copies of the label to print. 0-1024 + */ +- (void)cpclLabelWithOffset:(NSInteger)offset + hRes:(NSInteger)hRes + vRes:(NSInteger)vRes + height:(NSInteger)height + quantity:(NSInteger)quantity; + + +/** + Barcode + + @param type The type of barcode to print. + @param width The width of a narrow bar. + @param ratio The ratio of wide to narrow bars. 0-4,20-30 + @param height The height of the barcode. + @param x The X position where the barcode begins + @param y The Y position where the barcode begins + @param barcode The data to be encoded into a barcode + */ +- (void)cpclBarcode:(NSString * _Nonnull)type + width:(NSInteger)width + ratio:(NSInteger)ratio + height:(NSInteger)height + x:(NSInteger)x + y:(NSInteger)y + barcode:(NSString * _Nonnull)barcode; + +/** + VBarcode + + @param type The type of barcode to print. + @param width The width of a narrow bar. + @param ratio The ratio of wide to narrow bars. + @param height The height of the barcode. + @param x The X position where the barcode begins + @param y The Y position where the barcode begins + @param barcode The data to be encoded into a barcode + */ +- (void)cpclBarcodeVertical:(NSString * _Nonnull)type + width:(NSInteger)width + ratio:(NSInteger)ratio + height:(NSInteger)height + x:(NSInteger)x + y:(NSInteger)y + barcode:(NSString * _Nonnull)barcode; + + +/** + BarcodeQR + + @param xPos The X position where the barcode begins + @param yPos The Y position where the barcode begins + @param model The ratio of wide to narrow bars:1 or 2 + @param unitWidth Unit-width of the barcode in dots 范围是1-32,默认是6 + */ +- (void)cpclBarcodeQRcodeWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + model:(NSInteger)model + unitWidth:(NSInteger)unitWidth; + +/** + VBarcodeQR + + @param xPos The X position where the barcode begins + @param yPos The Y position where the barcode begins + @param model The ratio of wide to narrow bars:1 or 2 + @param unitWidth Unit-width of the barcode in dots + */ +- (void)cpclBarcodeQRcodeVerticalWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + model:(NSInteger)model + unitWidth:(NSInteger)unitWidth; + + +/** + QR Data + + @param data Data for barcode + @param config Configuration options for barcode:MN:nunber,MA:Numbers or letters + */ +- (void)cpclBarcodeQRcodeData:(NSString * _Nonnull)data config:(NSString * _Nonnull)config; + + +/** + The QR code terminator. + */ +- (void)cpclBarcodeQRcodeEnd; + + +/** + BARCODE-TEXT + + @param font A font name or number to create the representation + @param fontSize The size of the font: 0-999 + @param offset How far in units the text is from the barcode:0-999 + */ +- (void)cpclBarcodeTextWithFont:(NSInteger)font + fontSize:(NSInteger)fontSize + offset:(NSInteger)offset; + + +/** + BARCODE-TEXT + + @param font The filename of the TTF font with extension + @param xScale The X size of the font, in dots: 0-999 + @param yScale The Y size of the font, in dots: 0-999 + @param offset How far in units the text is from the barcode: 0-999 + */ +- (void)cpclBarcodeTextWithTrueTypeFont:(NSInteger)font + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + offset:(NSInteger)offset; + +/** + off barcodeText + */ +- (void)cpclBarcodeTextOff; + +/** + * 绘制矩形 Draw rectangle + * + * @param xPos (0~65535) + * @param yPos (0~65535) + * @param xEnd (0~65535) + * @param yEnd (0~65535) + * @param thickness (0~65535) + */ +- (void)cpclBoxWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd + thickness:(NSInteger)thickness; + +- (void)cpclCenterWithRange:(NSInteger)range; + +- (void)cpclCenter; + +- (void)cpclCompressedGraphicsWithImageWidth:(NSInteger)imageWidth + imageHeight:(NSInteger)imageHeight + x:(NSInteger)x + y:(NSInteger)y + bitmapData:(NSData * _Nonnull)bitmapData; + +- (void)cpclConcatStartWithXPos:(NSInteger)xPos yPos:(NSInteger)yPos; +- (void)cpclConcatVerticalStartWithXPos:(NSInteger)xPos yPos:(NSInteger)yPos; + +/** 字段拼接 Field combination */ +- (void)cpclConcatTextWithFont:(NSInteger)font + fontSize:(NSInteger)fontSize + offset:(NSInteger)offset + text:(NSString * _Nonnull)text; + +- (void)cpclConcatScaleTextWithScaledFont:(NSInteger)scaledFont + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + offset:(NSInteger)offset + text:(NSString * _Nonnull)text; + +- (void)cpclConcatScaleTextVerticalWithScaledFont:(NSInteger)scaledFont + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + offset:(NSInteger)offset + text:(NSString * _Nonnull)text; + +- (void)cpclConcatTextWithFontGroup:(NSInteger)fontGroup + offset:(NSInteger)offset + text:(NSString * _Nonnull)text; + +- (void)cpclConcatEnd; +- (void)cpclPrint; +/** 反向打印 Reverse print */ +- (void)cpclPoPrint; + +/** + 反白框 + + @param xPos 起点的x坐标 + @param yPos 起点的y坐标 + @param xEnd 终点的x坐标 + @param yEnd 终点的y坐标 + @param thickness 框的高度 + */ +- (void)cpclInverseLineWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd + thickness:(NSInteger)thickness; + +- (void)cpclLeft:(NSInteger)range; + +- (void)cpclLeft; + +- (void)cpclLineWithXPos:(NSInteger)xPos + yPos:(NSInteger)yPos + xEnd:(NSInteger)xEnd + yEnd:(NSInteger)yEnd + thickness:(NSInteger)thickness; + +- (void)cpclMoveWithRight:(NSInteger)right up:(NSString * _Nonnull)up; +- (void)cpclMultiLineStartWithLineHeight:(NSInteger)lineHeight; +- (void)cpclMultiLineEnd; +- (void)cpclPageWidth:(NSInteger)pageWidth; +- (void)cpclRight:(NSInteger)right; +- (void)cpclRight; +- (void)cpclRotate:(NSInteger)degrees; +- (void)cpclScaleText:(NSString * _Nonnull)scaledFont + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +- (void)cpclScaleTextVertical:(NSString * _Nonnull)scaledFont + xScale:(NSInteger)xScale + yScale:(NSInteger)yScale + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +- (void)cpclScaleToFit:(NSString * _Nonnull)scaleFont + width:(NSInteger)width + height:(NSInteger)height + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +/** + 设置字体加粗 + Set the font bold + + @param boldness bold value, 0 is not bold + */ +- (void)cpclSetBold:(NSInteger)boldness; + +/** + 设置字间距 + Set character spacing + + @param spacing 字间距 character spacing + */ +- (void)cpclSetSpacing:(NSInteger)spacing; + +/** + 设置字体放大倍数 + Set font magnification multiple + + @param width 宽度放大系数 magnification multiple of width + @param height 高度放大系数 magnification multiple of height + */ +- (void)cpclSetMagWithWidth:(NSInteger)width height:(NSInteger)height; +- (void)cpclTempMove:(NSInteger)right up:(NSInteger)up; + +/* + font english chinese + 1 9x24 24x24 + 2 8x24 24x24 + 3 10x20 20x20 + 4 16x32 32x32 + 5 12x24 24x24 + 7 12x24 24x24 + 8 12x24 12x24 + 20 8x18 18x18 + 28 14x28 28x28 + 55 8x16 16x16 + */ + +/*! + * + * 打印自动换行文本. + * + * @param rotate 文字旋转方向:0、90、180、270 + * @param font 字体:1、2、3、4、5、7、8、20、28、55 + * @param fontSize 字体大小 + * @param x 起始位置x + * @param y 起始位置y + * @param safeHeight 打印区域高度,超过高度部分不会打印 + * @param width 打印区域宽度,宽度为0表示不自动换行 + * @param lineSpacing 行间隔 + * @param fontScale 字体放大倍数 + * @param text 打印内容 + * @return 自动换行后的实际打印高度 + * + */ +- (NSInteger)cpclAutoTextWithRotate:(NSInteger)rotate + font:(NSInteger)font + fontSize:(NSInteger)fontSize + x:(NSInteger)x + y:(NSInteger)y + safeHeight:(NSInteger)safeHeight + width:(NSInteger)width + lineSpacing:(NSInteger)lineSpacing + fontScale:(NSInteger)fontScale + text:(NSString * _Nonnull)text; + +/*! + * + * 打印自动换行文本,此接口解决旋转90后打印居中文本,旋转90\270后,cpclCenter接口无效 + * + * @param rotate 文字旋转方向 + * @param font 字体 + * @param fontSize 字体大小 + * @param xPos 起始位置x + * @param yPos 起始位置y + * @param center 是否居中 + * @param safeHeight 打印区域高度,超过高度部分不会打印 + * @param width 打印区域宽度,宽度为0表示不自动换行 + * @param lineSpacing 行间隔. + * @param fontScale 字体放大倍数 + * @param text 打印内容 + * @return 自动换行后的实际打印高度 + */ +- (NSInteger)cpclAutoTextWithRotate:(NSInteger)rotate + font:(NSInteger)font + fontSize:(NSInteger)fontSize + xPos:(NSInteger)xPos + yPos:(NSInteger)yPos + center:(BOOL)center + safeHeight:(NSInteger)safeHeight + width:(NSInteger)width + lineSpacing:(NSInteger)lineSpacing + fontScale:(NSInteger)fontScale + text:(NSString * _Nonnull)text; + +/** + Thai Auto + + @param font 0:big font 大字体 1:small font 小字体 + @param fontSize fontSize + @param x x-coordinate of start point + @param y y-coordinate of start point + @param lineSpace Line spacing for automatic line feed 默认值30 + @param width Print width 默认0,若x+width大于页面宽度w的话,width=w-x + @param text text + */ +- (void)cpclAutoThaiTextWithFont:(NSInteger)font + fontSize:(NSInteger)fontSize + x:(NSInteger)x + y:(NSInteger)y + lineSpace:(NSInteger)lineSpace + width:(NSInteger)width + text:(NSString * _Nonnull)text; + + +/** + 打印居中文本 + Print center text + + @param rotate 旋转角度 : rotation angle + @param font 字号 暂时支持 1 2 3 4 8 55 :font size, temporarily supports 1 2 3 4 8 55 + @param fontSize 字体大小 : font size + @param x 起点x坐标 : x-coordinate of start point + @param y 起点y坐标 : y-coordinate of start point + @param width 文本框宽度 : width of textbox + @param text 文字内容 : content of text + */ +- (void)cpclCenterTextWithRotate:(NSInteger)rotate + font:(NSInteger)font + fontSize:(NSInteger)fontSize + x:(NSInteger)x + y:(NSInteger)y + width:(NSInteger)width + text:(NSString * _Nonnull)text; + +/** + 打印文字 + Print text + + @param rotate 文字旋转角度 : rotation angle of text + @param font 字体编号 : font number + @param fontSize 字体大小 暂不可用 : font size, cannot be used temporarily + @param x 起点x坐标 : x-coordinate of start point + @param y 起点y坐标 : y-coordinate of start point + @param text 文字内容 : content of text + */ +- (void)cpclTextWithRotate:(NSInteger)rotate + font:(NSInteger)font + fontSize:(NSInteger)fontSize + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + + +//反白 +- (void)cpclTextReverseWithFont:(NSInteger)font + fontSize:(NSInteger)fontSize + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; +// 反白 加粗 Reverse bold +/** + | Font | Chinese | ASCII character (English, number, etc.) | + | Font | 中文 | ASCII字符(英文,数字等) | + | ---- | ----- | --------------- | + | 1 | 24*24 | 9*17 | + | 2 | 24*24 | 8*16 | + | 3 | 20*20 | 10*20 | + | 4 | 32*32 | 16*32 | + | 8 | 24*24 | 12*24 | + | 55 | 16*16 | 8*16 | + + rotate: 0 90 180 270 + + */ +- (void)appendTextWithFont:(NSInteger)font + rotate:(NSInteger)rotate + fontSize:(NSInteger)fontSize + reverse:(BOOL)reverse + bold:(NSInteger)bold + x:(NSInteger)x + y:(NSInteger)y + text:(NSString * _Nonnull)text; + +/** + Set Background + + @param value 0~255,n=0:normal + */ +- (void)cpclSetBackground:(NSInteger)value; + +/** + set back text + + @param font 1,2,3,4,8,55 + @param rotate 0 90 180 270 + @param fontSize Size identifier for the font + @param xPos x-coordinate of start point + @param yPos y-coordinate of start point + @param text The text data to be printed + */ +- (void)cpclBackTextWithFont:(NSInteger)font + rotate:(NSInteger)rotate + fontSize:(NSInteger)fontSize + xPos:(NSInteger)xPos + yPos:(NSInteger)yPos + text:(NSString *_Nonnull)text; + +/***************** Line Print Commands *******************/ + +- (void)cpclLineMargin:(NSInteger)offset; +- (void)cpclSetPositionWithXPos:(NSInteger)xPos yPos:(NSInteger)yPos; +- (void)cpclSetPositionWithXPos:(NSInteger)xPos; +- (void)cpclSetPositionWithYPos:(NSInteger)yPos; + +/** + lineFeed + */ +- (void)cpclLineFeed; +- (void)cpclContrast:(NSInteger)value; +- (void)cpclFeed:(NSInteger)amount; +- (void)cpclLabel; +- (void)cpclMulti:(NSInteger)quantity; +- (void)cpclNoPace; +- (void)cpclPace; +- (void)cpclPostFeed:(NSInteger)amount; +- (void)cpclPreFeed:(NSInteger)amount; +- (void)cpclReverse:(NSInteger)amount; +- (void)cpclSetFeed:(NSInteger)length skip:(NSInteger)skip; + +/** + set the maximum speed + + @param value 0-5 + */ +- (void)cpclSpeed:(NSInteger)value; + +//Take the paper to the next label +- (void)cpclForm; +- (void)cpclTone:(NSInteger)value; +- (void)cpclTurn:(NSInteger)degrees; +- (void)cpclFormFeed; + +/****************** Utility and Diagnostic Commands ****************/ +- (void)cpclAbort; +- (void)cpclOnFeed_Feed; +- (void)cpclOnFeed_Reprint; +- (void)cpclOnFeed_Ignore; +- (void)cpclReRun; +- (void)cpclWait:(NSInteger)duration; +- (void)cpclSetLabelPositionWithXPos:(NSInteger)xPos yPos:(NSInteger)yPos; +- (void)cpclSetLabelPositionWithXPos:(NSInteger)xPos; +- (void)cpclSetLabelPositionWithYPos:(NSInteger)yPos; + +/****************** Codepage Commands ****************/ +/** + 设置字符代码页 + SetCharacterCodePage + + @param codepage parameter + eg: + "USA" "FRANCE" "GERMANY" "UK" "DENMARK" "SWEDEN" "ITALY" "SPAIN" "JAPAN-S" "NORWAY" "DENMARK II" "SPAIN II" "LATIN9" "KOREA" "SLOVENIA" "CHINA" "BIG5" "CP874" "CP850" "CP437" "CP860" "CP863" "CP865" "CP866" "CP852" "CP858" "CP857" "CP737" "CP720" "CP775" "CP855" "CP862" "CP864" "ISO8859-6" "ISO8859-8" "ISO8859-9" "ISO8859-15" "WPC1252" "WPC1250" "WPC1251" "WPC1252" "WPC1254" "WPC1255" "WPC1256" "ISO8859-1" "ISO8859-2" "ISO8859-3" "ISO8859-4" "ISO8859-5" "TIS11" "TIS18" + */ +- (void)cpclSetCharacterCodePage:(NSString *_Nonnull)codepage; + +/** + 阿拉伯语变形,设置后重启打印机 + + @param function 48:关闭; 49:变形1,按单词排序;50:变形2,按短语排序;51:变形3,按完整规则排序 + */ +- (void)cpclSetArabicTransformFunction:(NSInteger)function; + +/** + 查询阿拉伯语变形状态,00 00:关闭; 01 00:变形1; 02 00:变形2; 03 00:变形3 + */ +- (void)cpclGetArabicTransformStatus; + +/** + 泰文变形开启 + + @param status 48:close 49:open + */ +- (void)cpclSetThaiTransformStatus:(NSInteger)status; + +/** + 越南语变形,设置后重启打印机 + + @param function 48:关闭; 49:ASCII输入; 50:UTF-8输入 + */ +- (void)cpclSetVietnameseTransformFunction:(NSInteger)function; + +/** + 查询越南语变形状态,00 00:关闭; 01 00:ASCII输入; 02 00:UTF-8输入; + */ +- (void)cpclGetVietnameseTransformStatus; + + +/// 升级打印机固件 +/// @param data 固件数据 +- (void)updatePrinterFirmwareWithData:(NSData *_Nonnull)data; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTOldCommandTSPL.h b/ios/frameworks/PrinterSDK.framework/Headers/PTOldCommandTSPL.h new file mode 100644 index 0000000..3527713 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTOldCommandTSPL.h @@ -0,0 +1,649 @@ +/*! + * \~chinese + * 该类是SDK3.0.0之前的版本,由于很多客户还是使用之前的SDK,优化接口后改动太大,就用一个类保留之前的接口 + * + * \~english + * This class is a version before SDK3.0.0. Since many customers still use the previous SDK, after optimizing the interface and making too much change, use a class to retain the previous interface. + */ + +#import +#import "SDKDefine.h" +#import "PTBitmap.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PTOldCommandTSPL : NSObject + +@property(strong,nonatomic,readwrite) NSMutableData *cmdData; + +@property (nonatomic, assign) NSStringEncoding encoding; + +/** + * printer print self-test message. + * 自检,打印打印机信息 + */ +- (void)selfTest; + +- (void)appendCommand:(NSString *)cmd; + +/** 打印并走纸一行 + * Print and feed one line + */ +- (void)printAndLineFeed; + + +/** + set font bold + 设置字体加粗 + + @param bold 0:不加粗 1:加粗 + */ +- (void)setFontBold:(NSInteger)bold; + +/** + 自动回传打印机状态 + 开启之后,每打印一张都会返回10个字节的数据,格式:指令头4个字节(aa bb cc dd) + 4个字节的打印张数(从开启到关闭的打印总张数) + 1个字节的状态 + 结束符00 + + 会返回两次数据,第一次表示返回可获取打印总张数和状态,第二次表示打印结束 + eg:1.aabbccdd 03000000 2000 + 2.aabbccdd ffffffff 0000 :打印结束;aabbccdd 00000000 0000:关闭自动回传 + @param status 1:开启自动回传 3:关闭自动回传 + */ +- (void)setPrinterStateAutomaticBackWithStatus:(NSInteger)status; + +/** + * setting print area size in paper. + * 打印纸张范围大小 打印纸的毫米 + */ +- (void)setPrintAreaSizeWithWidth:(NSInteger)label_width + Height:(NSInteger)label_height; + +/** + + get print status + 开盖因为不好判断纸张,所以默认无纸 + + 返回一个字节 + bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 + 1 1 1 1 1 1 1 1 + 高温 开盖 打印中 暂停 丝带 缺纸 卡纸 开盖 + */ +- (void)getPrinterStatus; + +/** + * setting gap distance during labels. + * 设置标签纸的间距 + * + * @param distance 两张标签紙中间的垂直距离 + * @param offset 垂直间距的偏移 + */ +- (void)setGapWithDistance:(NSInteger)distance + Offset:(NSInteger)offset; + +/** + * setting black line + * 设置黑线 + * + * @param height 黑线的高度 0~25.4 mm + * @param offset 黑线偏移量 0~label length + * height,offset 为0,0表示连续标签 + */ +- (void)setBlineWithHeight:(NSInteger)height + Offset:(NSInteger)offset; + +/** + * paper feed with distance. + * 走纸 + */ +- (void)setOffsetWithDistance:(NSInteger)distance; + +/** + * setting print sets and copies. + * 打印数量 + * + * @param sets 多少份 how many sets of labels will be printed. + * @param copies 每份多少张 how many copies should be printed for each particular label set. + */ +- (void)printWithSets:(NSInteger)sets Copies:(NSInteger)copies; + + +/** + 打印自动换行文本,针对矢量字库的机型 + + @param x_pos x起始坐标 + @param y_pos y起始坐标 + @param font 字体:1-9,1-8:只能打印英文 9:中英文都能打(一般选择9) + @param rotation 打印方向 + @param x_multiplication font是1-8时:表示放大横向放大倍数 font是9的时候,表示文本的横向大小,eg:24 + @param y_multiplication font是1-8时:表示放大纵向放大倍数 font是9的时候,表示文本的纵向大小,eg:24 + @param safeHeight 打印的高度范围,超过部分不会打印 + @param width 打印的宽度范围,等于0的时候不自动换行 + @param lineSpacing 行间距 + @param text 文本 + @return 返回实际的打印高度 + */ +- (NSInteger)printAutoTextForVectorWithXpos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + font:(NSInteger)font + rotation:(NSInteger)rotation + xMultiplication:(NSInteger)x_multiplication + yMultiplication:(NSInteger)y_multiplication + safeHeight:(NSInteger)safeHeight + width:(NSInteger)width + lineSpacing:(NSInteger)lineSpacing + text:(NSString *)text; + + +/** + 打印自动换行文本,针对点阵字库的机型 + + @param x_pos x起始坐标 + @param y_pos y起始坐标 + @param font 字体:0-1,0:12x24 24x24 1:8x16 16x16 + @param rotation 打印方向 + @param x_multiplication 横向放大倍数:1-10 + @param y_multiplication 纵向放大倍数:1-10 + @param safeHeight 打印的高度范围,超过部分不会打印 + @param width 打印的宽度范围,等于0的时候不自动换行 + @param lineSpacing 行间距 + @param text 文本 + @return 返回实际的打印高度 + */ +- (NSInteger)printAutoTextWithXpos:(NSInteger)x_pos + yPos:(NSInteger)y_pos + font:(NSInteger)font + rotation:(NSInteger)rotation + xMultiplication:(NSInteger)x_multiplication + yMultiplication:(NSInteger)y_multiplication + safeHeight:(NSInteger)safeHeight + width:(NSInteger)width + lineSpacing:(NSInteger)lineSpacing + text:(NSString *)text; + + +/** + 打印文本 + + @param x_pos 距离x起点坐标 + @param y_pos 距离y起点坐标 + @param font 字体大小 英文字体:0-8 中文:9 + @param rotation 0 90 180 270 + @param x_multiplication 英文字体:1-10 中文:40-80(大小可调) + @param y_multiplication 英文字体:1-10 中文:40-80(大小可调) + @param text 打印的文本 + */ +- (void)appendTextWithXpos:(NSInteger)x_pos + Ypos:(NSInteger)y_pos + Font:(NSInteger)font + Rotation:(NSInteger)rotation + Xmultiplication:(NSInteger)x_multiplication + Ymultiplication:(NSInteger)y_multiplication + Text:(NSString *)text; + +/** + * clean printer buffer. + * 清除打印机缓冲区 + */ +- (void)setCLS; + +/** + * print barcode. + * 打印一维条码 + * + * @param type bar code type @[128,128M,EAN128,25,25C,39,29S,93,EAN13,EAN13+2,EAN13+5,EAN8,EAN8+5,CODA,POST,UPCA,UPCA+2,UPCA+5,UPCE,UPCE+2,UPCE+5,CPOST,MSI,MSIC,PLESSEY,ITF14,EAN14,11]; + * @param readable 是否可读:0,不可读,1,可读 whether it is readable:0: unreadable; 1: readable + * @param rotation rotation:0,90,180,270 + * @param narrow 窄元素 narrow element + * @param wide 宽元素 wide element + */ + +/** + print barcode. + 打印一维条码 + eg:100,100,”39”,96,1,0,2,4,”1000” 、 10,10,”128M”,48,1,0,2,2,”!104!096ABCD!101EFGH” + + @param x_pos Specify the x-coordinate of the bar code on the label + @param y_pos Specify the y-coordinate of the bar code on the label + @param type bar code type @[128,128M,EAN128,25,25C,39,29S,93,EAN13,EAN13+2,EAN13+5,EAN8,EAN8+5,CODA,POST,UPCA,UPCA+2,UPCA+5,UPCE,UPCE+2,UPCE+5,CPOST,MSI,MSIC,PLESSEY,ITF14,EAN14,11]; + @param height Bar code height (in dots) + @param readable 是否可读:0,不可读,1,可读 whether it is readable:0: unreadable; 1: readable + @param rotation rotation:0,90,180,270 + @param narrow 窄元素 narrow element + @param wide 宽元素 wide element + @param codeNumber the maximum number of digits of bar code content + */ +- (void)printBarcodeWithXPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos + Type:(NSString *)type + Height:(NSInteger)height + HumanReadable:(NSInteger)readable + Rotation:(NSInteger)rotation + Narrow:(NSInteger)narrow + Wide:(NSInteger)wide + CodeNumber:(NSString *)codeNumber; + +/** + print QRCode + 打印二维条码 + eg:100,10,L,7,M,0,M1,S1,"ATHE FIRMWARE HAS BEEN UPDATED" + + @param x_pos The upper left corner x-coordinate of the QR code + @param y_pos The upper left corner y-coordinate of the QR code + @param ecc_level Error correction recovery level + L :7% M :15% Q : 25% H : 30% + @param width 1~10 + @param mode A/M A:Auto M:Manual + @param rotation 0 、 90 、180 、270 + @param model M1: (default), original version M2: enhanced version + @param mask S0~S8, default is S7 + @param text The encodable character set is described as below + */ +- (void)printQRcodeWithXPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos + EccLevel:(NSString *)ecc_level + CellWidth:(NSInteger)width + Mode:(NSString *)mode + Rotation:(NSInteger)rotation + Model:(NSString *)model + Mask:(NSString *)mask + Text:(NSString *)text; + + +/** + Print Bitmap + 打印位图,取反已经在SDK中处理 + + @param xpos Specify the x-coordinate + @param ypos Specify the y-coordinate + @param mode mode Graphic modes listed below: 0:OVERWRITE 1:OR 2:XOR 3:compress 16:OVERWRITE compress 17:OR compress 18:XOR compress + @param image image + @param bitmapMode binary/dithering + @param compress TIFF/ZPL2/LZO/None + @return The data is less than the cache and can be printed NO:The data exceeds the cache and cannot be printed + */ +- (BOOL)addBitmapWithXPos:(NSInteger)xpos + YPos:(NSInteger)ypos + Mode:(NSInteger)mode + image:(CGImageRef)image + bitmapMode:(PTBitmapMode)bitmapMode + compress:(PTBitmapCompressMode)compress; + +#pragma mark BasicSetting 基本设定 + +/** + * setting print speed + * 设置打印速度 + * + */ +- (void)setSpeed:(NSInteger)speed; + +/** + * setting print density + * 设置打印浓度 + * + * @param density 浓度 0~15 level + */ +- (void)setDensity:(NSInteger)density; + +/** + * setting print direction and mirror. + * 设置打印的方向和镜像 + * + * @param direction 方向,面对打印机,向自己方向出纸,0,正常,1,方向 + * @param mirror 镜像,可选项 0 普通,1 镜像 + */ +- (void)setDirection:(NSInteger)direction Mirror:(NSInteger)mirror; + +/** + * setting print reference position + * 设置标签参考起点 + * + */ +- (void)setReferenceXPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos; + +/** + * page 18. + * setting the code page of inernational character set.设置国际字符集 + 7-bit code page name: + USA: USA + BRI: British + GER: German + FRE: French + DAN: Danish + ITA: Italian + SPA: Spanish + SWE: Swedish + SWI: Swiss + + 8-bit code page number: + 437: United States + 850: Multilingual + 852: Slavic + 860: Portuguese + 863: Canadian/French + 865: Nordic + 857: Turkish (TSPL2 printers only) + + Windows code page: + 1250: Central Europe (TSPL2 printers only) + 1252: Latin I (TSPL2 printers only) + 1253: Greek (TSPL2 printers only) + 1254: Turkish (TSPL2 printers only) + * + * @param codepage 字符集代码 + */ +- (void)setCodePage:(NSString *)codepage; + +/** + * page 21. + * feed label with the specified length.设置标签进纸长度 + * + * @param feedLength (1~9999) + */ +- (void)setFeedLength:(NSInteger)feedLength; + +/** + * feed label to the beginning of next label.设置进纸到下一标签起始处 + */ +- (void)setFormFeed; + +/** 回纸 */ +- (void)setBackFeed:(NSInteger)distance; +- (void)setBackUP:(NSInteger)distance; + +/** + * page 25. + * feed label until the internal sensor has determined the origin.设置标签定位到内部传感器确定的起点 + */ +- (void)setHome; + +/** + * page 28. + * control the sound frequency of the beeper.设置蜂鸣 + * + * @param level 0-9 + * @param interval 1-4095 + */ +- (void)setSoundWithLevel:(NSInteger)level + Interval:(NSInteger)interval; + +/** + * page 29. + * activate the cutter to immediately cut the labels without back feeding the label.设置切纸 + */ +- (void)setCut; + +/** + * page 30. + * 设置停止送纸 + */ +- (void)setLimitFeed:(NSInteger)max_len; + +/** + * page 32. + * draw a bar on the label format.在标签上画一条线 + */ +- (void)printBarWithXPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos + Width:(NSInteger)width + Height:(NSInteger)height; + +/** + * page 39. + * draw rectangles on the label.在标签上绘制矩形 + * @param thickness 线宽 + */ +- (void)setBoxWithXStart:(NSInteger)x_start + YStart:(NSInteger)y_start + XEnd:(NSInteger)x_end + YEnd:(NSInteger)y_end + Thickness:(NSInteger)thickness; + +/** 在标签上绘制椭圆 */ +- (void)setEllipseWithXStart:(NSInteger)x_start + YStart:(NSInteger)y_start + Width:(NSInteger)width + Height:(NSInteger)height + Thickness:(NSInteger)thickness; + +/** + * page 41. + * draw a circle on the label.在标签上绘制圆形 + * + * @param diameter 直径 + * @param thickness 线宽 + */ +- (void)setCircleWithXStart:(NSInteger)x_start + YStart:(NSInteger)y_start + Diameter:(NSInteger)diameter + Thickness:(NSInteger)thickness; + +/** + * page 43. + * clear a specified region in the image buffer.擦除图像缓冲区指定的区域 + */ +- (void)setEraseWithXStart:(NSInteger)x_start + YStart:(NSInteger)y_start + XWidth:(NSInteger)x_width + YHeight:(NSInteger)y_height; + +/** + * page 42. + * define the DataMatrix 2D bar code.Currently,only ECC200 error correction is supported. + * 设置 DataMatrix 二维码,当前仅支持 ECC200 错误纠正 + * + * @param xm [可选],Module size,x6,x8 + * @param row [可选],范围:10-144 + * @param col [可选],范围:10-144 + * @param expression 表达式 + */ +- (void)setDmatrixWithExpression:(NSString *)expression + XPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos + Width:(NSInteger)width + Height:(NSInteger)height + XM:(NSString *)xm + Row:(NSString *)row + Col:(NSString *)col; + +/** + * page 44. + * define a 2D Maxicode.打印 Maxicode 二维码 + * + * @param mode 2,3,4,5 + * @param iClass [option],Class of Service ,3-digit number(for mode 2,3) + * @param country [option],Country code, 3-digit number (for mode 2,3) + * @param post [option], + Mode 2: (USA) 5-digit+ 4-digit number. + Mode 3: (Canada) 6 alphanumeric post code included by double quotes. + * @param lm Expression length (double quote is ignored) , 范围:1-138, (this parameter is just for mode 4 and 5.) + */ +- (void)setMaxicode:(NSString *)text + XPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos + Mode:(NSInteger)mode + Class:(NSInteger)iClass + Country:(NSInteger)country + Post:(NSString *)post + LM:(NSInteger)lm; + +/** + * + * page 46. + * define a PDF417 2D barcode. + + [Option] + + P Data compression method + 0: Auto encoding + 1: Binary mode + + E Error correction level. Range: 0~8 Center pattern in barcode area + 0: The pattern will print upper left justified the area + 1: The pattern is printed middle of area + + Ux,y,c Human readable + x: Human readable characters in the specified x-coordinate + y: Human readable characters in the specified y-coordinate + c: Maximum characters of human readable character per line + + W Module width in dot. Range: 2~9 + H Bar height in dot. Range: 4~99 + R Maximum number of rows + C Maximum number of columns + T Truncation. + 0: Not truncated + 1: Truncated + + * @param option 可选项 + */ +- (void)printPDF417WithXPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos + Width:(NSInteger)width + Height:(NSInteger)height + Rotate:(NSInteger)rotate + Option:(NSString *)option + Expression:(NSString *)expression; + +/** page 50 */ +- (void)printAztecWithXPos:(NSInteger)XPos + YPos:(NSInteger)YPos + rotate:(NSInteger)rotate + size:(NSInteger)size + ecp:(NSInteger)ecp + flg:(NSInteger)flg + menu:(NSInteger)menu + multi:(NSInteger)multi + rev:(NSInteger)rev + aztecData:(NSString *)aztecData; + +/** + * page 52. + * print Bitmap format image. + */ +- (void)putBMPWithFilename:(NSString *)filename + XPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos; + +/** + * page 54. + * print PCX format images. + */ +- (void)putPCXWithFilename:(NSString *)filename + XPos:(NSInteger)x_pos + YPos:(NSInteger)y_pos; + +/** + * page 63. + * reverse a region in image buffer. + */ +- (void)setReverseWithXStart:(NSInteger)x_start + YStart:(NSInteger)y_start + XWidth:(NSInteger)x_width + YHeight:(NSInteger)y_height; + +#pragma mark Device Reconfiguration Commands + +/** + * page 32. + * setting the counter number in the program and its increments.计数器设置 + * + * @param counterNumber 第几个计数器 which number of counter(0-50) + * @param step 计数间隔 counting interval (-99999999 ~ 99999999) + */ +- (void)setCounterWithCounterNumber:(NSInteger)counterNumber + Step:(NSInteger)step; + +- (void)setCutterON; +- (void)setCutterOFF; +- (void)setCutterBATCH; + +/** + * set number of printing labels per cut + * + * @param pieces (0 ~ 65535) + */ +- (void)setCutterPieces:(NSInteger)pieces; + +- (void)setPARTIAL_CUTTER_OFF; +- (void)setPARTIAL_CUTTER_BATCH; + +/** + * set number of printing labels per cut + * + * @param pieces (0 ~ 65535) + */ +- (void)setPARTIAL_CUTTER_Pieces:(NSInteger)pieces; + +- (void)setBackOFF; +- (void)setBackON; + +/** + * This setting is used to enable/disable the KEY1/KEY2/KEY3 function. + * + * @param index KEY1,KEY2,KEY3 + * @param switcher ON/OFF + */ +- (void)setKEY:(NSInteger)index Switch:(NSString *)switcher; + +/** + * This setting is used to enable/disable the LED function. + LED1 Power on/off + LED2 Printer on-line/off-line + LED3 Error/normal + * + * @param index LED1,LED2,LED3 + * @param switcher ON/OFF + */ +- (void)setLED:(NSInteger)index Switch:(NSString *)switcher; + +- (void)setPeelON; +- (void)setPeelOFF; + +/** + * This command is used to enable/disable feeding of labels to gap/black mark position for tearing off. + * This setting will be saved in printer memory when turning off the power. + */ +- (void)setTearON; +- (void)setTearOFF; + +- (void)setStriperON; +- (void)setStriperOFF; + +/** + * This setting is used to enable/disable head open sensor. + */ +- (void)setHeadON; +- (void)setHeadOFF; + +- (void)setRibbonON; +- (void)setRibbonOFF; + +/** + * This setting defines communication parameters for printer serial port. + * + * @param baud 24,48,96,19,38,57,115( 对应单位2400 bps,4800 bps,9600 bps,38400 bps,15200 bps) + * @param parity N,E,O(NO/Even/Odd parity check) + * @param data 7,8(bits Data) + * @param stop 1,2(stop bit) + */ +- (void)setCOM1WithBaud:(NSInteger)baud + Parity:(NSString *)parity + Data:(NSString *)data + Stop:(NSString *)stop; + +/** + * This command will print one label and feed label gap to tear br position for tearing away. + * This setting will be saved in printer memory. + * + * @param key OFF/ON/AUTO/ + */ +- (void)setPrintKey:(NSString *)key; + +- (void)setReprintON; +- (void)setReprintOFF; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTPrinter.h b/ios/frameworks/PrinterSDK.framework/Headers/PTPrinter.h new file mode 100644 index 0000000..666f44c --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTPrinter.h @@ -0,0 +1,51 @@ +/*! + * \~chinese + * @header PTPrinter.h + * @abstract 打印机属性 + * + * \~english + * @header PTPrinter.h + * @abstract Printer properties + */ + +#import +#import +#import "PTRouter.h" + +/// 打印机的连接模块 +typedef NS_ENUM(NSInteger, PTPrinterModule) { + + PTPrinterModuleUnknown = 0, /// 未知类型 + PTPrinterModuleBLE = 1, /// 蓝牙 + PTPrinterModuleWiFi = 2, /// 无线 + PTPrinterModuleBoth = 3, /// 蓝牙和无线 +}; + +@interface PTPrinter : NSObject + +/// 打印机名称 +@property(strong,nonatomic,readwrite) NSString *name; +/// 打印机mac地址 +@property(strong,nonatomic,readwrite) NSString *mac; +/// 打印机蓝牙模块 +@property(assign,nonatomic,readwrite) PTPrinterModule module; +/// 发现蓝牙时获取到的广播信息 +@property(strong,nonatomic,readwrite) NSDictionary *advertisement; +/// 蓝牙外设UUID +@property(strong,nonatomic,readwrite) NSString *uuid; +/// 发现外设时获取到的信号强度值,单位分贝 +@property(strong,nonatomic,readwrite) NSNumber *rssi; +/// 信号强度等级分0-5级 +@property(strong,nonatomic,readwrite) NSNumber *strength; +/// 由信号强度计算的距离 +@property(strong,nonatomic,readwrite) NSNumber *distance; +/// 蓝牙外设 +@property(strong,nonatomic,readwrite) CBPeripheral *peripheral; +/// 外设的ip地址 +@property(strong,nonatomic,readwrite) NSString *ip; +/// 端口 +@property(strong,nonatomic,readwrite) NSString *port; + +- (instancetype)initWithPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI; + +@end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PTRouter.h b/ios/frameworks/PrinterSDK.framework/Headers/PTRouter.h new file mode 100644 index 0000000..e3e501f --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PTRouter.h @@ -0,0 +1,96 @@ +/*! + * \~chinese + * @header PTRouter.h + * @abstract 路由器属性 + * + * \~english + * @header PTRouter.h + * @abstract Router properties + */ + +#import + +@interface PTRouter : NSObject + +/*! + * \~chinese + * 广播地址 + * + * \~english + * Broadcast address + */ +@property(strong,nonatomic,readwrite) NSString *broadcastIP; + +/*! + * \~chinese + * 本机地址 + * + * \~english + * Local address + */ +@property(strong,nonatomic,readwrite) NSString *localIP; + +/*! + * \~chinese + * 子网掩码 + * + * \~english + * Netmask + */ +@property(strong,nonatomic,readwrite) NSString *netmask; + +/*! + * \~chinese + * 接口 + * + * \~english + * Interface + */ +@property(strong,nonatomic,readwrite) NSString *interface; + +/*! + * \~chinese + * 网关 + * + * \~english + * Gateway + */ +@property(strong,nonatomic,readwrite) NSString *gateway; + +/*! + * \~chinese + * 是否连接路由器 + * + * \~english + * Whether to connect to the router + */ +@property(assign,nonatomic,readwrite) BOOL connected; + +/*! + * \~chinese + * mac地址 + * + * \~english + * Mac + */ +@property(strong,nonatomic,readwrite) NSString *MAC; + +/*! + * \~chinese + * 热点名称 + * + * \~english + * ssid + */ +@property(strong,nonatomic,readwrite) NSString *SSID; + +/*! + * \~chinese + * 热点详情 + * + * \~english + * SSIDDATA + */ +@property(strong,nonatomic,readwrite) NSString *SSIDDATA; + +@end diff --git a/ios/frameworks/PrinterSDK.framework/Headers/PrinterSDK.h b/ios/frameworks/PrinterSDK.framework/Headers/PrinterSDK.h new file mode 100644 index 0000000..894f751 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/PrinterSDK.h @@ -0,0 +1,51 @@ + + +#if TARGET_OS_IOS +#import +#elif TARGET_OS_MAC +#import +#endif + +#import + +//! Project version number for PrinterSDK. +FOUNDATION_EXPORT double PrinterSDKVersionNumber; + +//! Project version string for PrinterSDK. +FOUNDATION_EXPORT const unsigned char PrinterSDKVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +/*! *\~chinese ESC指令 *\~english ESC command */ +#import + +/*! *\~chinese TSPL指令 *\~english TSPL command */ +#import + +/*! *\~chinese ZPL指令 *\~english ZPL command */ +#import + +/*! *\~chinese CPCL指令 *\~english CPCL command */ +#import +#import + +#import +#import +#import + +/*! *\~chinese 图片处理 *\~english image manager */ +#import +#import +#import + +// Dispatch + +/*! *\~chinese 通讯 *\~english Communication */ +#import +#import +#import + + + + + diff --git a/ios/frameworks/PrinterSDK.framework/Headers/SDKDefine.h b/ios/frameworks/PrinterSDK.framework/Headers/SDKDefine.h new file mode 100644 index 0000000..4375e70 --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Headers/SDKDefine.h @@ -0,0 +1,12 @@ + + +#ifndef PublicDefine_h +#define PublicDefine_h + +#ifdef DEBUG +#define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]); +#else +#define NSLog(...) +#endif + +#endif /* PublicDefine_h */ diff --git a/ios/frameworks/PrinterSDK.framework/Info.plist b/ios/frameworks/PrinterSDK.framework/Info.plist new file mode 100644 index 0000000..45519e9 Binary files /dev/null and b/ios/frameworks/PrinterSDK.framework/Info.plist differ diff --git a/ios/frameworks/PrinterSDK.framework/Modules/module.modulemap b/ios/frameworks/PrinterSDK.framework/Modules/module.modulemap new file mode 100644 index 0000000..249e98d --- /dev/null +++ b/ios/frameworks/PrinterSDK.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module PrinterSDK { + umbrella header "PrinterSDK.h" + + export * + module * { export * } +} diff --git a/ios/frameworks/PrinterSDK.framework/PrinterSDK b/ios/frameworks/PrinterSDK.framework/PrinterSDK new file mode 100644 index 0000000..de8772e Binary files /dev/null and b/ios/frameworks/PrinterSDK.framework/PrinterSDK differ diff --git a/ios/hy_printer.podspec b/ios/hy_printer.podspec index 1797612..04ee202 100644 --- a/ios/hy_printer.podspec +++ b/ios/hy_printer.podspec @@ -17,7 +17,12 @@ A new flutter plugin project. s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' s.platform = :ios, '8.0' - + s.summary + # 第三方.a文件 + s.vendored_libraries = 'Classes/**/*.a' + # 第三方framework + s.ios.vendored_frameworks='Frameworks/PrinterSDK.framework' + s.vendored_frameworks = 'PrinterSDK.framework' # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } end diff --git a/lib/hy_printer.dart b/lib/hy_printer.dart index 1b3ade8..607db8b 100644 --- a/lib/hy_printer.dart +++ b/lib/hy_printer.dart @@ -36,7 +36,11 @@ class HyPrinter { ///-3:打印机与sdk不匹配 ///-4:连接失败 static Future connect(String address) async { - int result = await _channel.invokeMethod('connect', {'address': address}); + int result = -4; + await Future.delayed(const Duration(milliseconds: 2000), () async { + result = await _channel.invokeMethod('connect', {'address': address}); + }); + // int result = await _channel.invokeMethod('connect', {'address': address}); return result; }