You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

633 lines
20 KiB

3 years ago
/*!
* \~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 <Foundation/Foundation.h>
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
43 3 inch black mark
52 2 inch black mark
*/
- (void)cpclPaperTypeWithType:(NSInteger )type;
/**
* 2 Set the paper type
*
* @param type (0~5)
0: continuous paper
2 Label paper
42 2 inch black mark
53 3 inch black mark
64 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-420-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 :090180270
* @param font 1234578202855
* @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\270cpclCenter
*
* @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 0x+widthw,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 491502513
*/
- (void)cpclSetArabicTransformFunction:(NSInteger)function;
/**
00 00 01 001 02 002 03 003
*/
- (void)cpclGetArabicTransformStatus;
/**
@param status 48close 49:open
*/
- (void)cpclSetThaiTransformStatus:(NSInteger)status;
/**
@param function 48 49ASCII 50UTF-8
*/
- (void)cpclSetVietnameseTransformFunction:(NSInteger)function;
/**
00 00 01 00ASCII 02 00UTF-8
*/
- (void)cpclGetVietnameseTransformStatus;
/// 升级打印机固件
/// @param data 固件数据
- (void)updatePrinterFirmwareWithData:(NSData *_Nonnull)data;
@end
NS_ASSUME_NONNULL_END