使用打印机配套的程序不太方便,计划使用狐表来打印,请教一下如何处理。
一、基础信息
官网文档:https://soft-makeid.yuque.com/wwprint/api/wewin_print_dll#8bbd30a4
标签打印机为P50(免驱)
二、操作方法
将DLL库文件(64位)解压放到foxtable程序目录。
外部引用wwGeneralDll.dll
将PrintDll-NetDemo.zip里面的Program.cs转化为VB.NET(https://converter.telerik.com/)
命令窗口运行这个转换后的代码(见文后),提示如下
---------------------------
编译错误:无法加载引用的库“D:\foxtable\Professional\wwGeneralDll.dll”:试图加载格式不正确的程序。
---------------------------
以下内容为程序代码:
1 Dim type As Integer = WwGeneralDll.getConnectType()
2 Console.WriteLine(type & "")
3
4 If type < 10 Then
5 WwGeneralDll.ClosePort()
6 Dim dot As Integer = 8
7 Dim dpiType As Integer = WwGeneralDll.getDots(type)
8 Console.WriteLine(dpiType & "")
9
10 Select Case dpiType
11 Case 1
12 dot = 8
13 Case 2
14 dot = 12
15 Case 3
16 dot = 24
17 End Select
18
19 WwGeneralDll.OpenPort(type, 30 * dot, 0, 75 * dot)
20 Dim rfid As String = "01" & "06" & "3132" & "3334" & "3536"
21 WwGeneralDll.setNfcContent(rfid)
22 WwGeneralDll.PTK_DrawTextTrueTypeW(20, 20, 30, 15, "宋体", 0, 700, "重庆品胜科技")
23 Dim out_1 As Byte() = New Byte(0) {}
24 Dim len As Integer() = New Integer(0) {}
25 Dim r As Integer = WwGeneralDll.GetPreview(out_1, len, False)
26
27 If r = 1 AndAlso len(0) <> 0 Then
28 Dim out_str As Byte() = New Byte(len(0) - 1) {}
29 WwGeneralDll.GetPreview(out_str, len, False)
30 Dim res As String = System.Text.Encoding.[Default].GetString(out_str)
31 Console.WriteLine(res)
32 End If
33
34 WwGeneralDll.PTK_PrintLabel(1, 1)
35 WwGeneralDll.ClosePort()
36 Else
37 Console.WriteLine("未发现打印机!" & type)
38 End If
39
40
[此贴子已经被作者于2024/11/28 0:35:33编辑过]