服务热线
13713178909
电 话:13713178909
地 址:广东省东莞市南城区白马黄金路1号天安数码城A1栋1105
联系人:张先生
手机:13713178909
邮箱:kent@lesain.com
QQ:398405621
重庆分公司
联系人:李小姐
手机:18102328695
邮箱:aimee@lesain.com
地 址:重庆市南岸区茶园新区玉马路8号中国智能企业园D栋419
以Argox条码机的PPLB为例,下面是相关的函数调用及打印代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace C5_Test
{
public partial class Form1 : Form
{
[DllImport("Winpplb.dll")]
private static extern int B_Bar2d_Maxi(int x, int y, int cl, int cc, int pc, string data);
[DllImport("Winpplb.dll")]
private 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);
[DllImport("Winpplb.dll")]
private static extern int B_Bar2d_PDF417_N(int x, int y, int w, string para, string data);
[DllImport("Winpplb.dll")]
private static extern void B_ClosePrn();
[DllImport("Winpplb.dll")]
private static extern int B_CreatePrn(int selection, string filename);
[DllImport("Winpplb.dll")]
private static extern int B_Del_Form(string formname);
[DllImport("Winpplb.dll")]
private static extern int B_Del_Pcx(string pcxname);
[DllImport("Winpplb.dll")]
private static extern int B_Draw_Box(int x, int y, int thickness, int hor_dots, int ver_dots);
[DllImport("Winpplb.dll")]
private static extern int B_Draw_Line(char mode, int x, int y, int hor_dots, int ver_dots);
[DllImport("Winpplb.dll")]
private static extern int B_Error_Reporting(char option);
[DllImport("Winpplb.dll")]
private static extern int B_Get_DLL_VersionA(int nShowMessage);
[DllImport("Winpplb.dll")]
private static extern int B_Get_Graphic_ColorBMP(int x, int y, string filename);
[DllImport("Winpplb.dll")]
private static extern int B_Get_Pcx(int x, int y, string filename);
[DllImport("Winpplb.dll")]
private static extern int B_Initial_Setting(int Type, string Source);
[DllImport("Winpplb.dll")]
private static extern int B_Load_Pcx(int x, int y, string pcxname);
[DllImport("Winpplb.dll")]
private static extern int B_Open_ChineseFont(string path);
[DllImport("Winpplb.dll")]
private static extern int B_Print_Form(int labset, int copies, string form_out, string var);
[DllImport("Winpplb.dll")]
private static extern int B_Print_MCopy(int labset, int copies);
[DllImport("Winpplb.dll")]
private static extern int B_Print_Out(int labset);
[DllImport("Winpplb.dll")]
private static extern int B_Prn_Barcode(int x, int y, int ori, string type, int narrow, int width, int height, char human, string data);
[DllImport("Winpplb.dll")]
private static extern void B_Prn_Configuration();
[DllImport("Winpplb.dll")]
private static extern int B_Prn_Text(int x, int y, int ori, int font, int hor_factor, int ver_factor, char mode, string data);
[DllImport("Winpplb.dll")]
private static extern int B_Prn_Text_Chinese(int x, int y, int fonttype, string id_name, string data);
[DllImport("Winpplb.dll")]
private 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);
[DllImport("Winpplb.dll")]
private 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);
[DllImport("Winpplb.dll")]
private static extern int B_Select_Option(int option);
[DllImport("Winpplb.dll")]
private static extern int B_Select_Symbol(int num_bit, int symbol, int country);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Backfeed(char option);
[DllImport("Winpplb.dll")]
private static extern int B_Set_BMPSave(int nSave, string strBMPFName);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Darkness(int darkness);
[DllImport("Winpplb.dll")]
private static extern int B_Set_DebugDialog(int nEnable);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Direction(char direction);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Form(string formfile);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Labgap(int lablength, int gaplength);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Labwidth(int labwidth);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Originpoint(int hor, int ver);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Prncomport(int baud, char parity, int data, int stop);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Prncomport_PC(int nBaudRate, int nByteSize, int nParity, int nStopBits, int nDsr, int nCts, int nXonXoff);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Speed(int speed);
[DllImport("Winpplb.dll")]
private static extern int B_Set_ProcessDlg(int nShow);
[DllImport("Winpplb.dll")]
private static extern int B_GetUSBBufferLen();
[DllImport("Winpplb.dll")]
private static extern int B_EnumUSB(byte[] buf);
[DllImport("Winpplb.dll")]
private static extern int B_CreateUSBPort(int nPort);
[DllImport("Winpplb.dll")]
private static extern int B_ResetPrinter();
[DllImport("Winpplb.dll")]
private static extern int B_GetPrinterResponse(string pbuf, int nMax);
[DllImport("Winpplb.dll")]
private static extern int B_TFeedMode(int nMode);
[DllImport("Winpplb.dll")]
private static extern int B_TFeedTest();
[DllImport("Winpplb.dll")]
private static extern int B_CreatePort(int nPortType, int nPort, string filename);
[DllImport("Winpplb.dll")]
private static extern int B_Execute_Form(string form_out, string var);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//PPLBDLL Test code start
B_CreatePrn(0, null);
// USB Port Open
/*int nUSBDataLen;
byte[] pbuf;
nUSBDataLen = B_GetUSBBufferLen()+1;
pbuf = new byte[nUSBDataLen];
B_EnumUSB(pbuf);
B_CreateUSBPort(1);*/
// Open com3
//B_CreatePort(1, 3, null);
//B_Set_Darkness(8);
//B_Select_Option(1);
//B_Set_Labgap(50,24);
//B_Set_Labwidth(816);
//B_Set_Speed(2);
//B_Error_Reporting('S');
B_Prn_Text(100, 200, 0, 3, 1, 1, 'N', "FONT 3"); //Get a text string.
// B_Prn_Text(200,10,1,3,1,1,'N',"Text 3<+1>");
B_Prn_Barcode(20, 20, 0, "1", 3, 3, 75, 'B', "079-305"); //Get a bar code.
//Get a PDF-417 2D bar code.
//B_Bar2d_PDF417(50, 150, 400, 300, 0, 0, 3, 7, 10, 2, 0, 0, "ARGOXINFO");
//Get a Maxi Code 2D bar code.
B_Bar2d_Maxi(400, 10, 300, 400, 93065, "This MaxiCode");
B_Draw_Line('E', 380, 200, 100, 10); //Line Draw by Exclusive or operation.
//B_Draw_Line('O', 400, 180, 10, 100); //Line draw by or operation.
//B_Draw_Line('W', 380, 220, 100, 10); //Draw white line.
//B_Draw_Line('E', 450, 180, 20, 110); //Line Draw by Exclusive or operation.
//B_Draw_Box(0, 0, 5, 815, 300); //Draw a box.
// B_Get_Pcx(50,55,"phone.pcx"); //Print Graphics of .PCX.
//B_Get_Pcx(400,0,"test1.pcx");
B_Prn_Text_TrueType(450, 20, 40, "Times New Roman", 1, 400, 0, 0, 0, "AA", "Library Test");
// Get a truetype text
//B_Prn_Text_TrueType(30,50,20,"Arial",4,400,0,0,0,"AB","TrueType Font");
B_Print_Out(1);
B_ClosePrn();
//PPLBDLL Test code end
}
}
}