1091 lines
49 KiB
C#
1091 lines
49 KiB
C#
using System.Runtime.InteropServices;
|
||
|
||
namespace Tnb.WarehouseMgr.Print
|
||
{
|
||
public class PPLBUtility
|
||
{
|
||
private const uint IMAGE_BITMAP = 0;
|
||
private const uint LR_LOADFROMFILE = 16;
|
||
private static readonly string winPPLBDllPath = Path.Combine(AppContext.BaseDirectory, @"Library\x64", "Library\\x64\\Winpplb.dll");
|
||
private static readonly string winPortDllPath = Path.Combine(AppContext.BaseDirectory, @"Library\x64", "Library\\x64\\WinPort.dll");
|
||
|
||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||
private static extern IntPtr LoadImage(IntPtr hinst, string lpszName, uint uType,
|
||
int cxDesired, int cyDesired, uint fuLoad);
|
||
[DllImport("Gdi32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||
private static extern int DeleteObject(IntPtr ho);
|
||
public const string szSavePath = "C:\\Argox";
|
||
public const string szSaveFile = "C:\\Argox\\PPLB_Example.Prn";
|
||
private const string sznop1 = "nop_front\r\n";
|
||
private const string sznop2 = "nop_middle\r\n";
|
||
/// <summary>
|
||
/// 印出一个 Maxi Code 2D Barcode
|
||
/// </summary>
|
||
/// <param name="x">X 座标</param>
|
||
/// <param name="y">Y 座标</param>
|
||
/// <param name="cl">A 3-位数 Class code</param>
|
||
/// <param name="cc">A 3-位数 Country code</param>
|
||
/// <param name="pc">在美国 Post code 是一個4或5-位数,其他国家是 6 位数</param>
|
||
/// <param name="data">资料字串,最多84個字元</param>
|
||
/// <returns>0 -> OK</returns>
|
||
/// <example>ObjectId.B_Bar2d_Maxi(50, 50, 300, 400, 93065, “This MaxiCode”);</example>
|
||
/// <remarks>這个 B_Bar2d_Maxi 函数可以打印出一个 Maxi Code 2D Barcode</remarks>
|
||
[DllImport("Library\\x64\\Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Bar2d_Maxi(int x, int y, int cl, int cc, int pc, string data);
|
||
/// <summary>
|
||
/// 印出一个 PDF-417 2D Barcode
|
||
/// </summary>
|
||
/// <param name="x">X 座标</param>
|
||
/// <param name="y">Y 座标。(1 dot = 0.125 mm)</param>
|
||
/// <param name="w">最大打印宽度,单位 dots。
|
||
/// v;
|
||
///最大打印高度,单位 dots。
|
||
/// s;
|
||
/// 错误校正等級,范围:0~8。
|
||
/// c;
|
||
/// 资料压缩等級,范围:0 或 1。
|
||
/// px;
|
||
/// 模组宽度,范围:2~9 dots。
|
||
/// py;
|
||
/// 模组高度,范围:4~99 dots。
|
||
/// r;
|
||
/// 最大 row count。
|
||
/// l;
|
||
/// 最大 column count。
|
||
/// t;
|
||
/// Truncation flag,‘0’ 是 normal 和 ‘1’ 是 truncated.
|
||
/// o;
|
||
///打印方向,'0’是 0°,'1’是90°、'2’是180°,'3’是270°
|
||
///
|
||
/// </param>
|
||
/// <param name="v"></param>
|
||
/// <param name="s"></param>
|
||
/// <param name="c"></param>
|
||
/// <param name="px"></param>
|
||
/// <param name="py"></param>
|
||
/// <param name="r"></param>
|
||
/// <param name="l"></param>
|
||
/// <param name="t"></param>
|
||
/// <param name="o"></param>
|
||
/// <param name="data">资料字串。</param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Bar2d_PDF417(int x, int y, int w, int v, int s, int c, int px,
|
||
int py, int r, int l, int t, int o, string data);
|
||
/// <summary>
|
||
/// 印出一个 PDF-417 2D Barcode
|
||
/// </summary>
|
||
/// <param name="x"></param>
|
||
/// <param name="y"></param>
|
||
/// <param name="w"></param>
|
||
/// <param name="h"></param>
|
||
/// <param name="pParameter"></param>
|
||
/// <param name="data"></param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Bar2d_PDF417_N(int x, int y, int w, int h, string pParameter, string data);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Bar2d_DataMatrix(int x, int y, int r, int l, int h, int v, string data);
|
||
/// <summary>
|
||
/// 关闭打印端口
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// B_ClosePrn 函数会关闭开启的打印机端口,必須在所有打印函数之后執行
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern void B_ClosePrn();
|
||
/// <summary>
|
||
/// 开启 Printer 工作
|
||
/// </summary>
|
||
/// <param name="selection">
|
||
/// 选择端口或档案。
|
||
/// 0 -> print to file.
|
||
/// 1 -> lpt1, 2 -> lpt2, 3 -> lpt3
|
||
/// 4 -> com1, 5 -> com2, 6 -> com3
|
||
/// 10 -> pipe, 11 -> USBXXX, 12 -> USB
|
||
/// 13 -> LAN Client(TCP/IP)
|
||
/// </param>
|
||
/// <param name="filename">
|
||
/// 当 selection 是 0 时,资料则输出至档案,filename 为档案名称,可含路径。
|
||
/// 当 selection 是 10 时,filename 为输出路径或装置路径)。
|
||
/// 当 selection 是 11 时,filename 指的是想开启的USB之index, index由1开始;
|
||
/// 当 selection 是 12 时,filename 指的是想开启的USB装置路径,
|
||
/// 和nPort = 10的使用方法一样
|
||
/// 当 selection 內容是 13 时, filename 指的是想开启的IP Address, 使用TCP/IP去开启;
|
||
/// 预设的port值為9100, 若要指定port值, 如80, 則在IPAddress後加上字串":80".
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// 说明: B_CreatePrn() 函数會开启你选择的输出端口或开启你键入的输出档案。
|
||
/// 而这个函数必須在所有函数之前执行。
|
||
/// B_CreatePrn(), B_CreateUSBPort() , B_CreateNetPort() 和 B_CreatePort() 不能同时使用。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_CreatePrn(int selection, string filename);
|
||
/// <summary>
|
||
/// 删除 Form (表格)
|
||
/// </summary>
|
||
/// <param name="formname">
|
||
/// 表格名称,最多 9 个字。
|
||
/// 当 formname 內容是 '*'时将会清除打印机內所有表格。
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// 这个 B_Del_Form 函数會刪除打印机內,你输入的 Form (表格)名称。当
|
||
/// 你刪除它后,将不能再还原,但可以重新载入。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Del_Form(string formname);
|
||
/// <summary>
|
||
/// 刪除 Pcx 图档
|
||
/// </summary>
|
||
/// <param name="pcxname">
|
||
/// 图形名称,最多 9 个字。
|
||
/// 当 pcxname 內容是 '*'時将会清除打印机內 RAM 或 flash memory 所有图形。
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// 这个 B_Del_Pcx 函数會刪除打印机內,你输入的图形名称。当你刪除它后,
|
||
/// 將不能再还原,但可以重新載入。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Del_Pcx(string pcxname);
|
||
/// <summary>
|
||
/// 画一个框
|
||
/// </summary>
|
||
/// <param name="x">起点 X 坐标。</param>
|
||
/// <param name="y">起点 Y 坐标。(1 dot = 0.125 mm)</param>
|
||
/// <param name="thickness">指定框四边边线厚度。</param>
|
||
/// <param name="hor_dots">对角点 X 坐标。</param>
|
||
/// <param name="ver_dots">对焦点 Y 坐标。</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <remarks>
|
||
/// 这个個B_Draw_Box 函数会画一个属性是 “OR” 的框。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Draw_Box(int x, int y, int thickness, int hor_dots,
|
||
int ver_dots);
|
||
/// <summary>
|
||
/// 画一条线
|
||
/// </summary>
|
||
/// <param name="mode">
|
||
/// 选择线条种类
|
||
/// | mode | 線條種類. |
|
||
/// | E | Exclusive OR |
|
||
/// | O | OR |
|
||
/// | W | 白線,它會蓋掉先前影像 |
|
||
/// </param>
|
||
/// <param name="x">起点 X 坐标。</param>
|
||
/// <param name="y">起點 Y 坐标。(1 dot = 0.125 mm)</param>
|
||
/// <param name="hor_dots"></param>
|
||
/// <param name="ver_dots"></param>
|
||
/// <returns>0 -> OK.</returns>
|
||
///<remarks>
|
||
///这个 Draw_Line 函数会画一个属性是"OR"或"XOR"的线条及一条白线
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Draw_Line(char mode, int x, int y, int hor_dots, int ver_dots);
|
||
/// <summary>
|
||
/// 开启或关闭错误回传功能
|
||
/// </summary>
|
||
/// <param name="option">
|
||
/// 当 option 是’N’时 关闭状态回馈。
|
||
/// ‘S’ 是开启状态回馈。
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
///
|
||
/// </returns>
|
||
/// <example>B_Error_Reporting(‘S’);</example>
|
||
/// <remarks>
|
||
/// 这个 B_Error_Reporting 函数会使打印机状态回馈 Disable/Enable,这回
|
||
///馈通道是透过 RS232 Port。预定值是 Disable。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Error_Reporting(char option);
|
||
/// <summary>
|
||
/// 取得动态庫版本讯息
|
||
/// </summary>
|
||
/// <param name="nShowMessage">
|
||
/// 0 -> 讯息视窗不显现。
|
||
///1 -> 讯息视窗显现。
|
||
/// </param>
|
||
/// <returns>
|
||
/// B_Get_DLL_VersionA(); return version value.
|
||
/// 主版号 = (return version value) / 100.
|
||
/// 子版号 = (return version value) % 100.
|
||
///</returns>
|
||
///<example>
|
||
///int nVersion, nMainVersion, nSubVersion;
|
||
///nVersion = B_Get_DLL_Version(1);
|
||
///nMainVersion = nVersion / 100;
|
||
///nSubVersion = nVersion % 100;
|
||
/// </example>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern IntPtr B_Get_DLL_Version(int nShowMessage);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Get_DLL_VersionA(int nShowMessage);
|
||
/// <summary>
|
||
/// 转换 BMP 彩色图档变灰阶,并将图形存在打印机的 RAM 中
|
||
/// </summary>
|
||
/// <param name="x">X 座标。</param>
|
||
/// <param name="y">Y 座标。</param>
|
||
/// <param name="filename">
|
||
/// 图形档名称,可包含路径。
|
||
/// 格式如:XXXXXXXX.XXX 或 X:\XXX\XXX.XXX
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
/// Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <example>
|
||
/// B_Get_Graphic_ColorBMP(30, 20, “bb.bmp”);
|
||
/// B_Get_Graphic_ColorBMPEx(30, 20, 200, 150, 2, “bb1”, “bb.bmp”);//180 angle.
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Get_Graphic_ColorBMP() 函数可输入任何位元数的 BMP 图档,并自动转换
|
||
/// 为黑白灰阶图档送至打印机打印。
|
||
/// B_Get_Graphic_ColorBMPEx() 函式可做放大,缩小及旋转的功能,可利用档名当
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Get_Graphic_ColorBMP(int x, int y, string filename);
|
||
/// <summary>
|
||
/// 转换 BMP 彩色图档变灰阶,并将图形存在打印机的 RAM 中,此指令可设置图片宽与高
|
||
/// </summary>
|
||
/// <param name="x"></param>
|
||
/// <param name="y"></param>
|
||
/// <param name="nWidth"></param>
|
||
/// <param name="nHeight"></param>
|
||
/// <param name="rotate"></param>
|
||
/// <param name="id_name"></param>
|
||
/// <param name="filename"></param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Get_Graphic_ColorBMPEx(int x, int y, int nWidth, int nHeight,
|
||
int rotate, string id_name, string filename);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Get_Graphic_ColorBMP_HBitmap(int x, int y, int nWidth, int nHeight,
|
||
int rotate, string id_name, IntPtr hbm);
|
||
/// <summary>
|
||
/// 打印一个图形并将图形存在打印机的记忆体中
|
||
/// </summary>
|
||
/// <param name="x">X 座标</param>
|
||
/// <param name="y">Y 座标。(1 dot = 0.125 mm)</param>
|
||
/// <param name="filename">
|
||
/// 图形档名称,可含路径。
|
||
/// 格式如:XXXXXXXX.XXX 或 X:\XXX\XXX.XXX
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
/// Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <example>
|
||
/// B_Get_Pcx(10,100,“phone.pcx”);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Get_Pcx 函数会列印一个图形并将图形储存在打印机内的 RAM 或
|
||
/// flash memory。图形档必须是 PCX 的格式。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Get_Pcx(int x, int y, string filename);
|
||
/// <summary>
|
||
/// 前置处理
|
||
/// </summary>
|
||
/// <param name="Type">选择输入模式。0 -> 输入字串,1 -> 输入档案。</param>
|
||
/// <param name="Source">资料来源,可为字串或档案名称,可含路径。</param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <example>
|
||
/// string aa = “ZT\r\n”;
|
||
///B_Initial_Setting(0, aa);
|
||
///or
|
||
///B_Initial_Setting(1, “initfile.txt”);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Initial_Setting 函数前置处理的动作,是将一串 Command 先送至印表
|
||
/// 机,由字串或档案输入,在使用这个函数时,须先在 B_Create_Prn() 之后其他
|
||
/// 函数之前,可作为使用者自订型态。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Initial_Setting(int Type, string Source);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_WriteData(int IsImmediate, byte[] pbuf, int length);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_ReadData(byte[] pbuf, int length, int dwTimeoutms);
|
||
/// <summary>
|
||
/// 列印一个图形
|
||
/// </summary>
|
||
/// <param name="x">X 座标</param>
|
||
/// <param name="y">Y 座标。备注:1 dot = 0.125 mm。</param>
|
||
/// <param name="pcxname">图形档名称。</param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <example>
|
||
/// B_Load_Pcx(50, 30, “phone”);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Load_Pcx 函数会列印一个 PCX 格式图形,而图形必须事先载入打印
|
||
/// 机内的 RAM 或 flash memory 储存。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Load_Pcx(int x, int y, string pcxname);
|
||
/// <summary>
|
||
/// 开启使用中文字型档案 (1615 和 2424)。
|
||
/// </summary>
|
||
/// <param name="path">中文字型档案来源路径。</param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
///<example>
|
||
///B_Open_ChineseFont(“C:\ET3”);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Open_ChineseFont 函数开启中文点矩阵字型档案 (1615 和 2424),
|
||
/// 供 B_Prn_Text_Chinese 函数使用。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Open_ChineseFont(string path);
|
||
/// <summary>
|
||
/// 打印一个 FORM (表格),并输入 FORM 所有变数、计数资料
|
||
/// </summary>
|
||
/// <param name="labset">列印的份数,范围:1~32767。</param>
|
||
/// <param name="copies">複製的份数,范围:1~32767。</param>
|
||
/// <param name="form_out">表格名称,同于之前载入的 FORM 名称,或原先储存在打印机内的 FORM。</param>
|
||
/// <param name="var">输入 FORM 所有变数、计数资料,用 ",“依序分别区隔开。如果变数裡有”,“号,
|
||
///可用”;,"来代表逗号。</param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
/// Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <example>
|
||
/// B_Print_form(3, 2, “demo”, “2000,Bicycle”);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Print_Form 函数会送所有资料及表格到 Printer,这个函数使用前
|
||
/// 须先执行 B_Set_Form(),并在所有函数之后,B_ClosePrn() 之前执行。当使
|
||
/// 用此函数时,就不须执行 B_Print_Out()。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Print_Form(int labset, int copies, string form_out, string var);
|
||
/// <summary>
|
||
/// 打印所有资料和加上跳号复制功能
|
||
/// </summary>
|
||
/// <param name="labset">列印的份数,1 ~ 32767。</param>
|
||
/// <param name="copies">
|
||
/// 複製的份数,1 ~ 32767。
|
||
/// 当为 1 时同等于Print_Out()功能。
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0-> OK.
|
||
/// Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <example>
|
||
/// B_Print_MCopy(2, 2);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Print_MCopy 函数会送所有资料到 Printer,这个函数须在所有函数之后,
|
||
///B_ClosePrn() 之前执行,当使用此函数时,就不须执行 B_Print_Out()。
|
||
///它包含 B_Print_Out() 所有功能。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Print_MCopy(int labset, int copies);
|
||
/// <summary>
|
||
/// 送出打印内容
|
||
/// </summary>
|
||
/// <param name="labset">列印复制的份数</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <remarks>
|
||
/// 这个 B_Print_Out 函数会送所有资料到 Printer,这个函数须在所有函数之后,
|
||
///B_ClosePrn() 之前执行。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Print_Out(int labset);
|
||
/// <summary>
|
||
/// 打印一维条形码
|
||
/// </summary>
|
||
/// <param name="x">X 坐标。</param>
|
||
/// <param name="y">Y 坐标。</param>
|
||
/// <param name="ori">列印方向定位,'0’是 0°,'1’是90°、'2’是180°,'3’是270°</param>
|
||
/// <param name="type">
|
||
/// 条码型式、如下表:
|
||
///type 条码种类
|
||
///0 Code 128 UCC(shipping container code)
|
||
///1 Code 128 subset A, B and C
|
||
///1E UCC/EAN
|
||
///2 Interleaved 2 of 5
|
||
///2C Interleaved 2 of 5 with check sum digit
|
||
///2D Interleaved 2 of 5 with human readable check digit
|
||
///2G German Postcode
|
||
///2M Matrix 2 of 5
|
||
///2U UPC Interleaved 2 of 5
|
||
///3 Code 3 of 9
|
||
///3C Code 3 of 9 with check sum digit
|
||
///9 Code 93
|
||
///E30 EAN-13
|
||
///E32 EAN-13 2 digit add-on
|
||
///E35 EAN-13 5 digit add-on
|
||
///E80 EAN-8
|
||
///E82 EAN-8 2 digit add-on
|
||
///E85 EAN-8 5 digit add-on
|
||
///K Codabar
|
||
///P Postnet
|
||
///UA0 UPC-A
|
||
///UA2 UPC-A 2 digit add-on
|
||
///UA5 UPC-A 5 digit add-on
|
||
///UE0 UPC-E
|
||
///UE2 UPC-E 2 digit add-on
|
||
///UE5 UPC-E 5 digit add-on
|
||
///R14 RSS-14
|
||
///RL RSS Limited
|
||
///RS RSS Stacked
|
||
///RT RSS Truncated
|
||
///RSO RSS Stacked Omnidirectiona
|
||
///REX RSS Expanded
|
||
/// </param>
|
||
/// <param name="narrow">bar 宽度在最小单位,若是RSS条码,则此参数为条码寬度的倍数,范围为1 ~10,预设值为1。</param>
|
||
/// <param name="width">
|
||
/// 寬度在最小单位,
|
||
/// 若是RSS条码,则此参数为每列条码可包含的最大資料区域数量,只在使用RSS Expanded条码时
|
||
/// 有效,在其它类型的RSS条码中则为无效参数,范围为2 ~22,预设值为22,且此值必需為偶数。
|
||
/// </param>
|
||
/// <param name="height">
|
||
/// 条码高度。
|
||
/// RSS条码的标准的最小高度限制:
|
||
/// R14 -> 33 pixels
|
||
/// RL -> 10 pixels
|
||
/// RS -> 13 pixels
|
||
/// RT -> 13 pixels
|
||
/// RSO -> 69 pixels
|
||
/// REX -> 34 pixels
|
||
/// </param>
|
||
/// <param name="human">当 human 是'N'时,则不列印文字,当 human 是'B'时,则列印可读文字。</param>
|
||
/// <param name="data">
|
||
/// 资料字串,与资料末端加上<Operation Number>,则有跳号功能,
|
||
/// Operation: + or - 记号,Number: 0 ~ 32768 数值。
|
||
/// 若在RSS需要加上2D(composite symbol)的资料时, 需加上'|'符号, 如1234567890123|123.
|
||
/// RSS条码的最大数值限制:
|
||
/// R14 -> 9999999999999
|
||
/// RL -> 1999999999999
|
||
/// RS -> 9999999999999
|
||
/// RT -> 9999999999999
|
||
/// RSO -> 9999999999999
|
||
/// REX -> 74 digits
|
||
/// </param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <remarks>
|
||
/// 注:经测试,type=1E 手机不能识别;type=1 手机可识别;
|
||
/// 这个 B_Prn_Barcode 函数可以列印出一个指定类型的条码 功能。
|
||
/// </remarks>
|
||
[DllImport($"Library\\x64\\Winpplb.dll")]
|
||
|
||
public static extern int B_Prn_Barcode(int x, int y, int ori, string type, int narrow,
|
||
int width, int height, char human, string data);
|
||
/// <summary>
|
||
/// 获取标签宽度
|
||
/// </summary>
|
||
/// <param name="labelWidth"></param>
|
||
/// <returns></returns>
|
||
//[DllImport("Library\\x64\\Winpplb.dll")]
|
||
//public static extern int B_Get_PrintWidth(ref int labelWidth);
|
||
|
||
/// <summary>
|
||
/// 打印出打印机配置讯息
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 这个 B_Prn_Configuration 函数会打印打印机内部配置,包含设定、
|
||
/// firmware 版本、accessories、等…。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern void B_Prn_Configuration();
|
||
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
/// <summary>
|
||
/// 印出一行文字和加上跳號功能
|
||
/// </summary>
|
||
/// <param name="x">X 座标</param>
|
||
/// <param name="y">Y 座标</param>
|
||
/// <param name="ori">列印方向定位,'0’是 0°,'1’是90°、'2’是180°,'3’是270°</param>
|
||
/// <param name="font">选择字形,1~5 选择常伫字形。</param>
|
||
/// <param name="hor_factor">水平放大比例,范围:1~24。</param>
|
||
/// <param name="ver_factor">垂直放大比例,范围:1~24。</param>
|
||
/// <param name="mode">
|
||
/// 反白功能,'N’普通文字,'R’反白文字。
|
||
/// 资料字串,当尾端资料加上 格式为加上跳号功能,
|
||
/// Operation: + or - 记号,Number: 0 ~ 32768 数值。
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
/// Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <example>
|
||
///B_Prn_Text(50, 110, 0, 4, 1, 1, ‘N’, “A123456”); //无跳号功能
|
||
///or
|
||
///B_Prn_Text(50, 110, 0, 4, 1, 1, ‘N’, “A123456<-1>”); //有跳号功能
|
||
/// </example>
|
||
public static extern int B_Prn_Text(int x, int y, int ori, int font, int hor_factor, int ver_factor, char mode, string data);
|
||
/// <summary>
|
||
/// 打印出一行文字,使用中文字型档案 (1615 或 2424)
|
||
/// </summary>
|
||
/// <param name="x">X 座标</param>
|
||
/// <param name="y">Y 座标</param>
|
||
/// <param name="fonttype">矩阵字型选择。0 -> 1615、1 -> 2424。</param>
|
||
/// <param name="id_name">给予一个识别名称存放于打印机内,以后直接使用 B_Load_Pcx() 即可将旧图呼叫出来。</param>
|
||
/// <param name="data">文字内容。</param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// 这个 B_Prn_Text_Chinese 函数可以印出一行文字,使用中文点矩阵字型档案
|
||
///(1615 或 2424)。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Prn_Text_Chinese(int x, int y, int fonttype, string id_name, string data);
|
||
/// <summary>
|
||
/// 打印Windows仿真字
|
||
/// </summary>
|
||
/// <param name="x"></param>
|
||
/// <param name="y"></param>
|
||
/// <param name="FSize"></param>
|
||
/// <param name="FType"></param>
|
||
/// <param name="Fspin"></param>
|
||
/// <param name="FWeight"></param>
|
||
/// <param name="FItalic"></param>
|
||
/// <param name="FUnline"></param>
|
||
/// <param name="FStrikeOut"></param>
|
||
/// <param name="id_name"></param>
|
||
/// <param name="data"></param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Prn_Text_TrueType(int x, int y, int FSize, string FType,
|
||
int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut, string id_name,
|
||
string data);
|
||
/// <summary>
|
||
/// 打印出一行Windows仿真字,並控制字型的宽及高
|
||
/// </summary>
|
||
/// <param name="x">X 座标, 单位: 像素</param>
|
||
/// <param name="y">Y 座标, 单位: 像素</param>
|
||
/// <param name="FHeight">字型高度,单位为点(dot)</param>
|
||
/// <param name="FWidth">字型宽度,单位为点(dot)。FSize / FHeight / FWidth = (dpi * point) / 72.</param>
|
||
/// <param name="FType">TrueType font 字型名称。</param>
|
||
/// <param name="Fspin">TrueType font 字体旋转。1 -> 0, 2 -> 90, 3 -> 180, 4 -> 270</param>
|
||
/// <param name="FWeight">
|
||
/// TrueType font 字体粗细。
|
||
/// 0 and NULL and 400 -> 400 标准、
|
||
/// 100 -> 非常细、200 -> 极细、
|
||
/// 300 -> 细 、500 -> 中等、
|
||
/// 600 -> 半粗 、700 -> 粗 、
|
||
/// 800 -> 特粗 、900 -> 黑体。
|
||
/// </param>
|
||
/// <param name="FItalic">TrueType font 字体斜体。0 -> FALSE、1 -> TRUE。</param>
|
||
/// <param name="FUnline">TrueType font 字体加底线。0 -> FALSE、1 -> TRUE。</param>
|
||
/// <param name="FStrikeOut">TrueType font 字体加删除线。0 -> FALSE、1 -> TRUE。</param>
|
||
/// <param name="id_name">给予一个识别名称存放于打印机内,以后直接使用 B_Load_Pcx() 即可将旧图呼叫出来。</param>
|
||
/// <param name="data">
|
||
/// 文字内容。
|
||
/// B_Prn_Text_TrueType_Uni()与B_Prn_Text_TrueType_UniB()所输入的data格式为UTF-8、
|
||
/// UTF-16或Unicode big endian之字串,且需为0结尾。
|
||
/// </param>
|
||
/// <returns>
|
||
///0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
///</returns>
|
||
///<remarks>
|
||
///这个 B_Prn_Text_TrueType() 函数可以印出一行 True Type Font 文字。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Prn_Text_TrueType_W(int x, int y, int FHeight, int FWidth,
|
||
string FType, int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut,
|
||
string id_name, string data);
|
||
/// <summary>
|
||
/// 设置转印模式、启动 Cutter 或 Peel
|
||
/// </summary>
|
||
/// <param name="option">
|
||
/// 打印机功能选项。
|
||
///1 -> 开启热转,关闭 Cutter 和 Peel。
|
||
///2 -> 开启热感,关闭 Cutter 和 Peel。
|
||
///3 -> 开启热感和 Cutter,关闭 Peel。
|
||
///4 -> 开启热感和 Peel,关闭 Cutter。
|
||
///5 -> 开启热转和 Cutter,关闭 Peel。
|
||
///6 -> 开启热转和 Peel,关闭 Cutter。
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
/// Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <example>
|
||
/// B_Select_Option(1);
|
||
/// B_Select_Option2(3, 2);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// B_Select_Option, B_Select_Option2函数可以选择不同 Printer 选项,使印
|
||
///表机依据这些选项工作。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Select_Option(int option);
|
||
/// <summary>
|
||
/// 设置转印模式、启动 Cutter 或 Peel
|
||
/// </summary>
|
||
/// <param name="option"></param>
|
||
/// <param name="p"></param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Select_Option2(int option, int p);
|
||
/// <summary>
|
||
/// 符号设定选择
|
||
/// </summary>
|
||
/// <param name="num_bit">资料位元数量。8 是 8-bit data 和 7 是 7-bit data。</param>
|
||
/// <param name="symbol">
|
||
/// 符号设定。见下表:备注:工厂内定符号设定是 Code page 437(English)。
|
||
/// | 8 bit data | 7 bit data |
|
||
///|symbol| Code page |symbol| Code page |
|
||
/// | 0 |English(437) | 0 |USASCII |
|
||
/// | 1 |Latin(850) | 1 |British |
|
||
/// | 2 |Slavic(852) | 2 |German |
|
||
/// | 3 |Portugal(860) | 3 |French |
|
||
/// | 4 |Canadian?French(863)| 4 |Danish |
|
||
/// | 5 |Nordic(865) | 5 |Italian |
|
||
/// | | | 6 |Spanish |
|
||
/// | | | 7 |Swedish |
|
||
/// | | | 8 |Swiss |
|
||
/// csymbol;
|
||
///符号设定。见下表:备注:工厂内定符号设定是 Code page 437(English)。
|
||
///| 8 bit data | 7 bit data |
|
||
/// |symbol| Code page |symbol| Code page |
|
||
/// | 0 |English(437) | 0 |USASCII |
|
||
/// | 1 |Latin(850) | 1 |British |
|
||
///| 2 |Slavic(852) | 2 |German |
|
||
/// | 3 |Portugal(860) | 3 |French |
|
||
/// | 4 |Canadian/French(863)| 4 |Danish |
|
||
///| 5 |Nordic(865) | 5 |Italian |
|
||
/// | 6 |Turkish(857) | 6 |Spanish |
|
||
/// | 7 |Icelandic(861) | 7 |Swedish |
|
||
/// | 8 |Hebrew(862) | 8 |Swiss |
|
||
///| 9 |Cyrillic(855) | | |
|
||
///| 10 |Cyrillic CIS(866) | | |
|
||
///| 11 |Greek(737) | | |
|
||
///| 12 |Greek(851) | | |
|
||
///| 13 |Greek(869) | | |
|
||
///| A |Latin(1252) | | |
|
||
///| B |Latin(1250) | | |
|
||
///| C |Cyrillic(1251) | | |
|
||
///| D |Greek(1253) | | |
|
||
///| E |Turkish(1254) | | |
|
||
///| F |Hebrew(1255) | | |
|
||
/// </param>
|
||
/// <param name="country">KDU country code.</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Select_Symbol(int num_bit, int symbol, int country);
|
||
/// <summary>
|
||
/// 符号设定选择
|
||
/// </summary>
|
||
/// <param name="num_bit"></param>
|
||
/// <param name="csymbol"></param>
|
||
/// <param name="country"></param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Select_Symbol2(int num_bit, string csymbol, int country);
|
||
/// <summary>
|
||
/// 启动 Back feed
|
||
/// </summary>
|
||
/// <param name="option">
|
||
/// 功能选项,
|
||
/// “B” 关闭 Back feed。
|
||
/// “F” 启动 Back feed。
|
||
///它可吐出一定长度,让使用者看到印出结果。
|
||
/// </param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <example>B_Set_Backfeed(‘B’);</example>
|
||
/// <remarks>这个 B_Set_Backfeed 函数可以调整停止点。</remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Backfeed(char option);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Backfeed_Offset(int offset);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_CutPeel_Offset(int offset);
|
||
/// <summary>
|
||
/// 储存影像图档
|
||
/// </summary>
|
||
/// <param name="nSave">
|
||
/// 1 -> 储存图档
|
||
///0 -> 不储存图档
|
||
/// </param>
|
||
/// <param name="strBMPFName">储存图档的名称</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <example>B_Set_BMPSave(1, “C:\TempBMP.bmp”);</example>
|
||
/// <remarks>
|
||
/// 这个 B_Set_BMPSave 函数,可以决定是否储存影像图档。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_BMPSave(int nSave, string strBMPFName);
|
||
/// <summary>
|
||
/// 设置打印浓度
|
||
/// </summary>
|
||
/// <param name="darkness">设定打印头打印热度,范围:0~15,內定是 8。</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <remarks>
|
||
/// 這個 B_Set_Darkness 函数控制影像浓淡,想得到更好的印出品质,你应该
|
||
/// 考虑一些因素,印出图案样式、速度、耗材种类等。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Darkness(int darkness);
|
||
/// <summary>
|
||
/// 设置除错环境
|
||
/// </summary>
|
||
/// <param name="nEnable">
|
||
/// 1 -> 除错环境致能
|
||
/// 0 -> 除错环境关闭
|
||
/// </param>
|
||
/// <returns>0 -> OK.</returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_DebugDialog(int nEnable);
|
||
/// <summary>
|
||
/// 设置打印方向
|
||
/// </summary>
|
||
/// <param name="direction">
|
||
/// 设定列印方向,范围:B 和 T。它们是对角对称。内定是 T。
|
||
/// </param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <example>
|
||
/// B_Set_Direction(‘T’);
|
||
/// </example>
|
||
/// <remarks>这个 B_Set_Direction 函数设定列印方向,对整个版面内所有图形文字。</remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Direction(char direction);
|
||
/// <summary>
|
||
/// 储存并打印 FORM (表格)
|
||
/// </summary>
|
||
/// <param name="formfile">表格档案名称,可含路径。</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
///<example>B_Set_Form(“demo.prn”);</example>
|
||
///<remarks>
|
||
///这个 B_Set_Form 函数储存并列印 FORM (表格)。在使用这个函数时,须先
|
||
///在 B_Print_Form函数之前。使用此函数时,就必须执行 B_Print_Form()。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Form(string formfile);
|
||
/// <summary>
|
||
/// 同时设置标签长度及 GAP 长度
|
||
/// </summary>
|
||
/// <param name="lablength">在最后影像线段的标籤长度。单位 dot。</param>
|
||
/// <param name="gaplength">GAP 长度。当是连续纸时,必须设为 0。</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <remarks>
|
||
/// 这个 B_Set_Labgap 函数设定标籤长度及 GAP 长度。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Labgap(int lablength, int gaplength);
|
||
/// <summary>
|
||
/// 设置标签宽度
|
||
/// </summary>
|
||
/// <param name="labwidth">标籤宽度。单位 dot。</param>
|
||
/// <returns>0 -> OK</returns>
|
||
/// <remarks>
|
||
/// 这个 B_Set_Labwidth 函数设定标籤宽度。当使用此函数,就不能使用 B_Set_Originpoint 函数。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Labwidth(int labwidth);
|
||
/// <summary>
|
||
/// 设置打印初始位置
|
||
/// </summary>
|
||
/// <param name="hor">水平边界基点。单位 dot。</param>
|
||
/// <param name="ver">垂直边界基点。单位 dot。</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <example>
|
||
/// B_Set_Originpoint(0, 0);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Set_Originpoint 函数使用重新设定起源点 X、Y 轴。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Originpoint(int hor, int ver);
|
||
/// <summary>
|
||
/// 设置 Serial Port
|
||
/// </summary>
|
||
/// <param name="baud">
|
||
/// 鲍尔率,如下表:
|
||
///38 -> 38400
|
||
///19 -> 19200
|
||
///96 -> 9600
|
||
///48 -> 4800
|
||
///24 -> 2400
|
||
///57 -> 57600
|
||
///11 -> 115200
|
||
/// </param>
|
||
/// <param name="parity">。'O’是 odd,'E’是 even parity, 'N’是 none parity。</param>
|
||
/// <param name="data">Data bit number,7 或 8。</param>
|
||
/// <param name="stop">Stop bit number,1 或 2。</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <example>
|
||
///VC:
|
||
/// B_Set_Prncomport(96, ‘N’, 8, 1);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Set_Prncomport 函数会设定打印机序列埠设定值,来改变打印机相同于
|
||
///PC 序列埠设定值,如果不同则无法与 PC 连接。此函数必须在函数 Print_Out
|
||
///之前执行,必须单独执行。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Prncomport(int baud, char parity, int data, int stop);
|
||
/// <summary>
|
||
/// 设置 PC 序列埠
|
||
/// </summary>
|
||
/// <param name="nBaudRate">
|
||
/// 鲍尔率,如下表:
|
||
/// 1 -> 110 9 -> 19200
|
||
/// 2 -> 300 10 -> 38400
|
||
/// 3 -> 600 11 -> 56000
|
||
/// 4 -> 1200 12 -> 57600
|
||
/// 5 -> 2400 13 -> 115200
|
||
/// 6 -> 4800 14 -> 128000
|
||
/// 7 -> 9600 15 -> 256000
|
||
/// 8 -> 14400 0 -> 9600
|
||
/// </param>
|
||
/// <param name="nByteSize">
|
||
/// Data bit number:
|
||
/// 0 -> 7-bit data
|
||
/// 7 -> 7-bit data
|
||
/// 8 -> 8-bit data
|
||
/// </param>
|
||
/// <param name="nParity">
|
||
/// 0 -> none parity
|
||
/// 1 -> even parity
|
||
/// 2 -> odd parity
|
||
/// </param>
|
||
/// <param name="nStopBits"
|
||
/// Stop bit number:
|
||
/// 0 -> 1 stop bit
|
||
/// 1 -> 1 stop bit
|
||
/// 2 -> 2 stop bits
|
||
/// </param>
|
||
/// <param name="nDsr">
|
||
/// Setup hardware flow control
|
||
///1 -> DTR CONTROL HANDSHAKE;
|
||
///0 -> DTR CONTROL ENABLE;
|
||
/// </param>
|
||
/// <param name="nCts">
|
||
/// Setup hardware flow control
|
||
/// 1 -> RTS CONTROL HANDSHAKE;
|
||
/// 0 -> RTS CONTROL ENABLE;
|
||
/// </param>
|
||
/// <param name="nXonXoff">
|
||
/// Setup software flow control
|
||
/// 0 -> Enable;
|
||
/// 1 -> Disable;
|
||
/// </param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <example>
|
||
/// B_Set_Prncomport_PC(0, 0, 0, 0, 0, 0, 0);
|
||
/// </example>
|
||
/// <remarks>
|
||
/// 这个 B_Set_Prncomport_PC 函数会设定 PC 序列埠设定值,来改变 PC 相同于打印机序列埠
|
||
///设定值,如果不同则无法与打印机连接。此函数必须在函数 B_Print_Out 之前执行。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Prncomport_PC(int nBaudRate, int nByteSize, int nParity,
|
||
int nStopBits, int nDsr, int nCts, int nXonXoff);
|
||
/// <summary>
|
||
/// 设置打印速度
|
||
/// </summary>
|
||
/// <param name="speed">
|
||
/// 列印速度,范围:0~7。
|
||
///| speed Value | SPEED |
|
||
/// | 0 or 1 | 1 ips (25 mmps) |
|
||
/// | 2 | 2 ips (50 mmps) |
|
||
/// | 3 | 3 ips (75 mmps) |
|
||
///| 4 | 4 ips (100 mmps) |
|
||
/// | 5 | 5 ips (125 mmps) |
|
||
/// | 6 | 6 ips (150 mmps) |
|
||
/// | 7 | 7 ips (175 mmps) |
|
||
/// </param>
|
||
/// <returns></returns>
|
||
/// <remarks>
|
||
/// 这个 B_Set_Speed 函数设定列印速度,GT-2140最高速度可达4ips。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_Speed(int speed);
|
||
/// <summary>
|
||
/// 开启或关闭进度对话框
|
||
/// </summary>
|
||
/// <param name="nShow">
|
||
/// 0 -> 关闭。
|
||
///1 -> 开启。
|
||
/// </param>
|
||
/// <returns></returns>
|
||
/// <remarks>
|
||
/// 这个 B_Set_ProcessDlg 函数可开关进度对话框
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_ProcessDlg(int nShow);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_ErrorDlg(int nShow);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_GetUSBBufferLen();
|
||
/// <summary>
|
||
/// 枚举USB端口设备
|
||
/// </summary>
|
||
/// <param name="buf"></param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_EnumUSB(byte[] buf);
|
||
/// <summary>
|
||
/// 开启USB打印端口
|
||
/// </summary>
|
||
/// <param name="nPort">USB 传输埠, nPort由1开始</param>
|
||
/// <returns>0 :成功</returns>
|
||
/// <remarks>
|
||
/// 说明:用以开启USB打印机端口,开启成功后才可以打印标签内容。而这个函数必須在
|
||
/// B_EnumUSB()搜索到可用的USB打印机端口后,才能执行。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_CreateUSBPort(int nPort);
|
||
/// <summary>
|
||
/// 使打印机重开机
|
||
/// </summary>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
/// </returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_ResetPrinter();
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_GetPrinterResponse(byte[] buf, int nMax);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_TFeedMode(int nMode);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_TFeedTest();
|
||
/// <summary>
|
||
/// 开启端口進行传输
|
||
/// </summary>
|
||
/// <param name="nPortType">
|
||
/// 选择输出埠种类。
|
||
/// 0 -> 档案
|
||
/// 1 -> Serial port
|
||
/// 2 -> Parallel prot
|
||
/// 4 -> USB port
|
||
/// 5 -> LAN port
|
||
/// 6 -> USB port
|
||
/// </param>
|
||
/// <param name="nPort">选择输出埠编号。当 nPortType为 1 时, 1 -> com1, 2 -> com2,…</param>
|
||
/// <param name="filename">
|
||
/// 当 nPortType 为 0 时,资料则输出至档案,filename 为档案名称,可含路径。
|
||
/// 当 nPortType 为 4 时,filename 指的是想开启的USB的index, index由1开始.
|
||
/// 当 nPortType 为 5 时,filename 指的是想开启的IP Address, 使用TCP/IP,
|
||
/// port 9100去开启.
|
||
/// 当 nPortType 为 6 时,filename 指的是想开启的USB的装置路径.
|
||
/// </param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
/// <remarks>
|
||
/// 说明: B_CreatePort() 函数会开启你选择的输出埠或开启你键入的输出档。
|
||
/// 而这个函数必须在所有函数之前执行。
|
||
/// B_CreatePrn(), B_CreateUSBPort(), B_CreateNetPort() 和 B_CreatePort() 不能同时使用。
|
||
///</remarks>
|
||
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_CreatePort(int nPortType, int nPort, string filename);
|
||
/// <summary>
|
||
/// 打印一個已存在打印机內的 FORM (表格),并输入 FORM 所有变数、计数资料
|
||
/// </summary>
|
||
/// <param name="form_out"></param>
|
||
/// <param name="var"></param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Execute_Form(string form_out, string var);
|
||
/// <summary>
|
||
/// 打印 QR 條碼
|
||
/// </summary>
|
||
/// <param name="x">X 坐标</param>
|
||
/// <param name="y">Y 坐标</param>
|
||
/// <param name="model">QR条码模式,范围:1,2 (若不符范围则打印机会采用预设值: 2)。</param>
|
||
/// <param name="scl">条码尺寸,范围: 1~99 (若不符范围则打印机会采用预设值: 3)。</param>
|
||
/// <param name="error">
|
||
/// 错误校正等級。
|
||
/// L = Lower error correction, most data
|
||
///M = Default
|
||
///Q = Optimized for error correction over data
|
||
///H = Highest error correction, latest data
|
||
/// </param>
|
||
/// <param name="dinput">
|
||
/// 資料輸入模式。
|
||
///A = 自動模式
|
||
///M = 手動模式
|
||
///(若不符範圍則印表機會採用預設值: A)
|
||
/// </param>
|
||
/// <param name="c">項目 |Symbol Number| c | 1~16 |</param>
|
||
/// <param name="d">变数 | Divisions | d | 1~16 |</param>
|
||
/// <param name="p">范围 | Parity | p | 0~255|</param>
|
||
/// <param name="data">资料字串。</param>
|
||
/// <returns>0 -> OK.</returns>
|
||
/// <remarks>B_Bar2d_QR 函數可以列印 QR 条码,支持中文字及日文字。</remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Bar2d_QR(int x, int y, int model, int scl, char error,
|
||
char dinput, int c, int d, int p, string data);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_GetNetPrinterBufferLen();
|
||
/// <summary>
|
||
/// 枚举 Net Printer设备
|
||
/// </summary>
|
||
/// <param name="buf"></param>
|
||
/// <returns></returns>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_EnumNetPrinter(byte[] buf);
|
||
/// <summary>
|
||
/// 使用 网路进行传输
|
||
/// </summary>
|
||
/// <param name="nPort">USB 传输埠 ; LAN 传输埠, nPort由1开始.</param>
|
||
/// <returns>
|
||
/// 0 -> OK.
|
||
///Reference BW-Error.txt file.
|
||
/// </returns>
|
||
///<remarks>
|
||
///说明: B_CreateUSBPort() 和 B_CreateNetPort()函数会开启你选择的输出埠或
|
||
/// 开启你键入的输出档。而这个函数必须在所有函数之前执行。
|
||
/// B_CreatePrn(), B_CreateUSBPort() , B_CreateNetPort() 和 B_CreatePort() 不能同时使用。
|
||
/// </remarks>
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_CreateNetPort(int nPort);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Prn_Text_TrueType_Uni(int x, int y, int FSize, string FType,
|
||
int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut, string id_name,
|
||
byte[] data, int format);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Prn_Text_TrueType_UniB(int x, int y, int FSize, string FType,
|
||
int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut, string id_name,
|
||
byte[] data, int format);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_GetUSBDeviceInfo(int nPort, byte[] pDeviceName,
|
||
out int pDeviceNameLen, byte[] pDevicePath, out int pDevicePathLen);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_EncryptionKey(string encryptionKey);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Check_EncryptionKey(string decodeKey, string encryptionKey,
|
||
int dwTimeoutms);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_CommTimeout(int ReadTotalTimeoutConstant, int WriteTotalTimeoutConstant);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Get_CommTimeout(out int ReadTotalTimeoutConstant, out int WriteTotalTimeoutConstant);
|
||
[DllImport("Library\\x64\\Winpplb.dll")]
|
||
public static extern int B_Set_LabelForSmartPrint(int lablength, int gaplength);
|
||
|
||
|
||
}
|
||
}
|