#include "LabelMakerSDK.h"#include <iostream>#include <string>#include <sstream>#include <iomanip>#include "Label_tspl.h"#include "Shapes_tspl.h"#include "Text_tspl.h"#include "Barcode1D_tspl.h"#include "BcdAztec_tspl.h"#include "BcdDatamatrix_tspl.h"#include "BcdMaxicode_tspl.h"#include "BcdPdf417_tspl.h"#include "BcdQRCode_tspl.h"#include "cRfidWrite_tspl.h"#include "Coordinate.h"
宏定义 | |
| #define | TSPL 0 |
| #define | PGL 1 |
| #define | UINT32 unsigned int |
| #define | NON_USED -1 |
类型定义 | |
| typedef Label_tspl | LabelType |
| typedef Text_tspl | TextType |
| typedef MaxicodeBarcode_tspl | MexiCodeBarcodeType |
| typedef Pdf417Barcode_tspl | Pdf417BarcodeType |
| typedef DataMatrixBarcode_tspl | DataMatrixBarcodeType |
| typedef AztecBarcode_tspl | AztecBarcodeType |
| typedef QRBarcode_tspl | QRBarcodeType |
| typedef cRfidWrite_tspl | RfidWriteType |
| typedef Line_tspl | LineType |
| typedef Box_tspl | BoxType |
| typedef Barcode1D_tspl | Barcode1DType |
枚举 | |
| enum | { _MaxicodeMsgStructured = 0 , _MaxicodeMsgStructuredOpenSystemStandard , _MaxicodeMsg } |
函数 | |
| void | CreateLabel (int iPrintLanguageTyp, std::string LabelName, float dotsPerUnit, ScaleEnum unit) |
| 建立标签。 | |
| void * | CreateTexts (float x_start, float y_start, float fontsize_x, float fontsize_y, std::string data, ScaleEnum scale, FontSizeUnitsEnum FontSizeUnit, FontStyleEnum FontStyle, AlignEnum Alignment, std::string fontName, RotateEnum rotation) |
| 建立文字标签。 | |
| void * | CreateBarcode1D (float start_x, float start_y, std::string content, ScaleEnum scale, float narrowBar, float wideBar, float Height, BarcodeTypeEnum_1D BcdTyp, bool PrintHumanReadable, RotateEnum rotation, bool PdfLocTop) |
| 在标签中创建一维条形码。 | |
| void * | CreateLines (float start_x, float start_y, float end_x, float end_y, float lineThickness, ScaleEnum scale) |
| 在标签中创建线条。 | |
| void * | CreateBoxs (float start_x, float start_y, float end_x, float end_y, float lineThickness, ScaleEnum scale) |
| 在标签中创建框。 | |
| void * | CreateMaxicodeBarcodes (int iMaxicodeTyp, MaxicodeModeEnum mode, std::string postalCode, std::string countryCode, std::string serviceClass, std::string remainingMsg, std::string year, std::string primaryMsg, float start_x, float start_y, ScaleEnum scale, bool ZipperPattern, RotateEnum rotation) |
| 在标签中创建 Maxicode 条形码。 | |
| void * | CreatePdf417Bcodes (float start_x, float start_y, std::string content, ScaleEnum scale, float xdim, float ydim, Pdf417ErrCorrectionEnum ErrorCorrection, int row, int col, RotateEnum rotation) |
| 在标签中创建一维条形码。 | |
| void * | CreateAztecBarcodes (float start_x, float start_y, std::string content, ScaleEnum scale, float xdim, AztecCodeTypeEnum CodeType, int iFixedErrCorrection, int iLayers, RotateEnum rotation) |
| 在标签中创建 aztec 条形码。 | |
| void * | CreateDataMatrixBarcodes (float start_x, float start_y, std::string content, ScaleEnum scale, float xdim, RotateEnum Rotation, bool UseRectangle, std::string MatrixMultiLine, char CtrlChar1, char CtrlChar2, int row, int col) |
| 在标签中创建 data matrix 条形码。 | |
| void * | CreateQRBarcodes (float start_x, float start_y, std::string content, ScaleEnum scale, float xdim, QRCodeMaskEnum Mask, std::vector< std::tuple< QRCodeManualEncodingEnum, std::string > > *dataManuallyEncoded, QRCodeErrorCorrectionEnum errEnum, QRCodeModelEnum modelEnum, RotateEnum rotation) |
| 在标签中创建 QR 条形码。 | |
| std::string | ToHexString (const std::string &input) |
| void * | CreateRfidEncode (unsigned int a32BitField, unsigned int a16BitField, std::string a6CharAsciiString, RfidMemBlockEnum MemBlock, int iOffsetFromStart, std::string _10BytesUserData, std::string _4BytesHexUserData, RfidPasswordTypeEnum PasswordEnum, std::string Password) |
| 在标签中创建 RFID。 | |
| void | LabelToString (std::string &str) |
| 使用 TSPL 或 PGL 创建标签。 | |
| void | CloseLabel () |
| 释放资源。 | |
变量 | |
| LabelType * | gpLabel = nullptr |
| TextType * | gpTextType = nullptr |
| MexiCodeBarcodeType * | gpMexiCodeBarcodeType = nullptr |
| Pdf417BarcodeType * | gpPdf417BarcodeType = nullptr |
| DataMatrixBarcodeType * | gpDataMatrixBarcodeType = nullptr |
| AztecBarcodeType * | gpAztecBarcodeType = nullptr |
| QRBarcodeType * | gpQRBarcodeType = nullptr |
| RfidWriteType * | gpRfidWriteType = nullptr |
| LineType * | gpLineType = nullptr |
| BoxType * | gpBoxType = nullptr |
| Barcode1DType * | gpBarcode1DType = nullptr |
| PrintResolution * | gpPrinterResolution = nullptr |
| Ruler * | gpRuler = nullptr |
| CellRect * | gpCellRect = nullptr |
| CellSquare * | gpCellSquare = nullptr |
| std::vector< void * > | ObjectsPtr |
| std::vector< void * > | ObjRulerPtr |
| std::vector< void * > | ObjStartPtr |
| std::vector< void * > | ObjEndPtr |
| std::vector< void * > | ObjCellSquarePtr |
| std::vector< void * > | ObjCellRectPtr |
| std::vector< void * > | ObjTextItemPtr |
| int | giPrintLanguageTyp = 0 |
| #define NON_USED -1 |
| #define PGL 1 |
| #define TSPL 0 |
| #define UINT32 unsigned int |
| typedef AztecBarcode_tspl AztecBarcodeType |
| typedef Barcode1D_tspl Barcode1DType |
| typedef Box_tspl BoxType |
| typedef DataMatrixBarcode_tspl DataMatrixBarcodeType |
| typedef Label_tspl LabelType |
| typedef Line_tspl LineType |
| typedef MaxicodeBarcode_tspl MexiCodeBarcodeType |
| typedef Pdf417Barcode_tspl Pdf417BarcodeType |
| typedef QRBarcode_tspl QRBarcodeType |
| typedef cRfidWrite_tspl RfidWriteType |
| typedef Text_tspl TextType |
| void CloseLabel | ( | ) |
| void * CreateAztecBarcodes | ( | float | start_x, |
| float | start_y, | ||
| std::string | content, | ||
| ScaleEnum | scale, | ||
| float | xdim, | ||
| AztecCodeTypeEnum | CodeType, | ||
| int | iFixedErrCorrection, | ||
| int | iLayers, | ||
| RotateEnum | rotation ) |
在标签中创建 aztec 条形码。
| [in] | x_start | : x 坐标的起始点 |
| [in] | y_start | : Y 坐标的起始点 |
| [in] | content | : 条形码内容 |
| [in] | scale | : 设置比例 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | xdim | : 設定 x 座標的單元格大小 |
| [in] | CodeType | : 设置代码类型(例如 AztecCodeTypeEnum::Compact) |
| [in] | iFixedErrCorrection | : 设置固定错误更正(例如 AztecCodeTypeEnum::FixedErrCorrection) |
| [in] | iLayers | : 设置层数 |
| [in] | rotation | : 设定旋转角度 (RotateEnum::None/RotateEnum::ClockWise/RotateEnum::CounterClockWise/RotateEnum::Inverted) |
| void * CreateBarcode1D | ( | float | start_x, |
| float | start_y, | ||
| std::string | content, | ||
| ScaleEnum | scale, | ||
| float | narrowBar, | ||
| float | wideBar, | ||
| float | Height, | ||
| BarcodeTypeEnum_1D | BcdTyp, | ||
| bool | PrintHumanReadable, | ||
| RotateEnum | rotation, | ||
| bool | PdfLocTop ) |
在标签中创建一维条形码。
| [in] | x_start | : x 坐标的起始点 |
| [in] | y_start | : Y 坐标的起始点 |
| [in] | content | : 条形码内容 |
| [in] | scale | : 设置比例 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | narrowBar | : 窄条宽度 |
| [in] | wideBar | : 宽条宽度 |
| [in] | Height | : 设定高度 |
| [in] | BcdTyp | : 设置条形码类型(例如 BarcodeTypeEnum_1D::Code_128) |
| [in] | PrintHumanReadable | : 设置列印人眼可读的标志 |
| [in] | rotation | : 设定旋转角度 (RotateEnum::None/RotateEnum::ClockWise/RotateEnum::CounterClockWise/RotateEnum::Inverted) |
| [in] | PdfLocTop | : 设置一个标志将人眼可读的数据打印在条形码的上方。(默认值为下方) |
| void * CreateBoxs | ( | float | start_x, |
| float | start_y, | ||
| float | end_x, | ||
| float | end_y, | ||
| float | lineThickness, | ||
| ScaleEnum | scale ) |
在标签中创建框。
| [in] | x_start | : x 坐标的起始点 |
| [in] | y_start | : Y 坐标的起始点 |
| [in] | end_x | : X 坐标的终点 |
| [in] | end_y | : Y 坐标的终点 |
| [in] | lineThickness | : 设置线条粗细 |
| [in] | scale | : 设置比例 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| void * CreateDataMatrixBarcodes | ( | float | start_x, |
| float | start_y, | ||
| std::string | content, | ||
| ScaleEnum | scale, | ||
| float | xdim, | ||
| RotateEnum | Rotation, | ||
| bool | UseRectangle, | ||
| std::string | MatrixMultiLine, | ||
| char | CtrlChar1, | ||
| char | CtrlChar2, | ||
| int | row, | ||
| int | col ) |
在标签中创建 data matrix 条形码。
| [in] | x_start | : x 坐标的起始点 |
| [in] | y_start | : Y 坐标的起始点 |
| [in] | content | : 条形码内容 |
| [in] | scale | : 设置比例 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | xdim | : 设定 x 坐标的单元格大小 |
| [in] | Rotation | : 设定旋转角度 (RotateEnum::None/RotateEnum::ClockWise/RotateEnum::CounterClockWise/RotateEnum::Inverted) |
| [in] | UseRectangle | : 设置标志以使用矩形 |
| [in] | MatrixMultiLine | : 设置多行字符串 |
| [in] | rotationCtrlChar1 | : 设置 CtrlChar1 |
| [in] | rotationCtrlChar2 | : 设置 CtrlChar1 |
| [in] | row | : 设定行数以限制条形码的高度 |
| [in] | col | : 设定列数以限制条形码的宽度 |
| void CreateLabel | ( | int | iPrintLanguageTyp, |
| std::string | LabelName, | ||
| float | dotsPerUnit, | ||
| ScaleEnum | unit ) |
建立标签。
| [in] | iPrintLanguageTyp | : 设定 TSPL 或 PGL |
| [in] | LabelName | : 设定 TSPL 或 PGL |
| [in] | dotsPerUnit | : 设定 DPI (203/300/600) |
| [in] | unit | : 单位设定 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| void * CreateLines | ( | float | start_x, |
| float | start_y, | ||
| float | end_x, | ||
| float | end_y, | ||
| float | lineThickness, | ||
| ScaleEnum | scale ) |
在标签中创建线条。
| [in] | x_start | : x 坐标的起始点 |
| [in] | y_start | : Y 坐标的起始点 |
| [in] | end_x | : X 坐标的终点 |
| [in] | end_y | : Y 坐标的终点 |
| [in] | lineThickness | : 设置线条粗细 |
| [in] | scale | : 设置比例 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| void * CreateMaxicodeBarcodes | ( | int | iMaxicodeTyp, |
| MaxicodeModeEnum | mode, | ||
| std::string | postalCode, | ||
| std::string | countryCode, | ||
| std::string | serviceClass, | ||
| std::string | remainingMsg, | ||
| std::string | year, | ||
| std::string | primaryMsg, | ||
| float | start_x, | ||
| float | start_y, | ||
| ScaleEnum | scale, | ||
| bool | ZipperPattern, | ||
| RotateEnum | rotation ) |
在标签中创建 Maxicode 条形码。
| [in] | iMaxicodeTyp | : 选择 MaxiCode 类型(例如 _MaxicodeMsgStructured) |
| [in] | mode | : 设置 maxicode(例如 MaxicodeModeEnum::MODE_2 |
| [in] | postalCode | : 设置邮递区编码字符串 |
| [in] | countryCode | : 设置国家/地区代码字符串 |
| [in] | serviceClass | : 设置服务类字符串 |
| [in] | remainingMsg | : 设置剩余的消息字符串 |
| [in] | year | : 设置年份字符串 |
| [in] | primaryMsg | : 设置主消息字符串 |
| [in] | start_x | : x 坐标的起始点 |
| [in] | start_y | : Y 坐标的起始点 |
| [in] | scale | : 设置比例 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | ZipperPattern | : 是否为 zipper pattern 设置标志 |
| [in] | rotation | : 设定旋转角度 (RotateEnum::None/RotateEnum::ClockWise/RotateEnum::CounterClockWise/RotateEnum::Inverted) |
| void * CreatePdf417Bcodes | ( | float | start_x, |
| float | start_y, | ||
| std::string | content, | ||
| ScaleEnum | scale, | ||
| float | xdim, | ||
| float | ydim, | ||
| Pdf417ErrCorrectionEnum | ErrorCorrection, | ||
| int | row, | ||
| int | col, | ||
| RotateEnum | rotation ) |
在标签中创建一维条形码。
| [in] | x_start | : x 坐标的起始点 |
| [in] | y_start | : Y 坐标的起始点 |
| [in] | content | : 条形码内容 |
| [in] | scale | : 设置比例 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | xdim | 设定 x 坐标的单元格大小 |
| [in] | ydim | : 设定 y 坐标的单元格大小 单元格大小可以视为 PDF417 条形码行中最窄条形元素的宽度和高度。 改变最小元素的尺寸会影响条形码的整体宽度和高度。 |
| [in] | ErrorCorrection | : 设置错误更正级别(例如 Pdf417ErrCorrectionEnum::LEVEL_5) |
| [in] | row | : 设定行数以限制条形码的高度 |
| [in] | col | : 设定列数以限制条形码的宽度 |
| [in] | rotation | : 设定旋转角度 (RotateEnum::None/RotateEnum::ClockWise/RotateEnum::CounterClockWise/RotateEnum::Inverted) |
| void * CreateQRBarcodes | ( | float | start_x, |
| float | start_y, | ||
| std::string | content, | ||
| ScaleEnum | scale, | ||
| float | xdim, | ||
| QRCodeMaskEnum | Mask, | ||
| std::vector< std::tuple< QRCodeManualEncodingEnum, std::string > > * | dataManuallyEncoded, | ||
| QRCodeErrorCorrectionEnum | errEnum, | ||
| QRCodeModelEnum | modelEnum, | ||
| RotateEnum | rotation ) |
在标签中创建 QR 条形码。
| [in] | x_start | : x 坐标的起始点 |
| [in] | y_start | : Y 坐标的起始点 |
| [in] | content | : 条形码内容 |
| [in] | scale | : 设置比例 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | xdim | : 设定 x 坐标的单元格大小 |
| [in] | Mask | : 设置屏蔽(例如 QRCodeMaskEnum::Mask_4) |
| [in] | dataManuallyEncoded | : 设置手动编码数据 |
| [in] | errEnu | : 设置错误更正枚举(例如 QRCodeErrorCorrectionEnum::EC_15) |
| [in] | modelEnum | : 设置模型枚举(例如 QRCodeModelEnum::MODEL_1) |
| [in] | rotation | : 设定旋转角度 (RotateEnum::None/RotateEnum::ClockWise/RotateEnum::CounterClockWise/RotateEnum::Inverted) |
| void * CreateRfidEncode | ( | unsigned int | a32BitField, |
| unsigned int | a16BitField, | ||
| std::string | a6CharAsciiString, | ||
| RfidMemBlockEnum | MemBlock, | ||
| int | iOffsetFromStart, | ||
| std::string | _10BytesUserData, | ||
| std::string | _4BytesHexUserData, | ||
| RfidPasswordTypeEnum | PasswordEnum, | ||
| std::string | Password ) |
在标签中创建 RFID。
| [in] | a32BitField | : 设置 RFID 32 位字段 |
| [in] | a16BitField | : 设置 RFID 16 位字段 |
| [in] | a6CharAsciiString | : 设置 RFID 6 个字符的 ASCII 字符串 |
| [in] | MemBlock | : 设置内存区块(例如 RfidMemBlockEnum::EPC) |
| [in] | iOffsetFromStart | : 设置从起始点的偏移量 |
| [in] | _10BytesUserData | : 设置 RFID 10 字节字符串 |
| [in] | _4BytesHexUserData | : 设置 RFID 4 字节字符串 |
| [in] | PasswordEnum | : 设置密码枚举(例如 RfidPasswordTypeEnum::Lock) |
| [in] | Password | : 设置密码字符串 |

| void * CreateTexts | ( | float | x_start, |
| float | y_start, | ||
| float | fontsize_x, | ||
| float | fontsize_y, | ||
| std::string | data, | ||
| ScaleEnum | scale, | ||
| FontSizeUnitsEnum | FontSizeUnit, | ||
| FontStyleEnum | FontStyle, | ||
| AlignEnum | Alignment, | ||
| std::string | fontName, | ||
| RotateEnum | rotation ) |
建立文字标签。
| [in] | x_start | : x 坐标的起始点 |
| [in] | y_start | : Y 坐标的起始点 |
| [in] | fontsize_x | : x 坐标的字体大小 |
| [in] | fontsize_y | : Y 坐标的字体大小 |
| [in] | data | : 文字内容 |
| [in] | scale | : 设置比例尺 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | FontSizeUnit | : 设定字体大小单位 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | FontStyle | : 设定字体样式 (FontSizeUnitsEnum::Ruler/FontSizeUnitsEnum::Points/FontSizeUnitsEnum::Percent) |
| [in] | Alignment | : 设定文字对齐方式 (ScaleEnum::Dot/ScaleEnum::MM/ScaleEnum::Inch) |
| [in] | fontName | : 设定字体名称 (203/300/600) |
| [in] | rotation | : 设定旋转角度 (RotateEnum::None/RotateEnum::ClockWise/RotateEnum::CounterClockWise/RotateEnum::Inverted) |
| void LabelToString | ( | std::string & | str | ) |
使用 TSPL 或 PGL 创建标签。
| [out] | str | : TSPL 或 PGL 字符串 |
| std::string ToHexString | ( | const std::string & | input | ) |

| int giPrintLanguageTyp = 0 |
| AztecBarcodeType* gpAztecBarcodeType = nullptr |
| Barcode1DType* gpBarcode1DType = nullptr |
| BoxType* gpBoxType = nullptr |
| CellRect* gpCellRect = nullptr |
| CellSquare* gpCellSquare = nullptr |
| DataMatrixBarcodeType* gpDataMatrixBarcodeType = nullptr |
| LabelType* gpLabel = nullptr |
| LineType* gpLineType = nullptr |
| MexiCodeBarcodeType* gpMexiCodeBarcodeType = nullptr |
| Pdf417BarcodeType* gpPdf417BarcodeType = nullptr |
| PrintResolution* gpPrinterResolution = nullptr |
| QRBarcodeType* gpQRBarcodeType = nullptr |
| RfidWriteType* gpRfidWriteType = nullptr |
| Ruler* gpRuler = nullptr |
| TextType* gpTextType = nullptr |
| std::vector<void*> ObjCellRectPtr |
| std::vector<void*> ObjCellSquarePtr |
| std::vector<void*> ObjectsPtr |
| std::vector<void*> ObjEndPtr |
| std::vector<void*> ObjRulerPtr |
| std::vector<void*> ObjStartPtr |
| std::vector<void*> ObjTextItemPtr |