C#

C#,标签打印机打印中文

以下介绍标签打印机如何打出中文,其实就是转换成像素即可,我这的打印机时Zebra,需要引用Fnthex32.dll,Function:

public class LabelHelper
{
[System.Runtime.InteropServices.DllImport(“Fnthex32.dll “)]
public static extern int GETFONTHEX(
string chnstr,
string fontname,
int orient,
int height,
int width,
int bold,
int italic,
StringBuilder hexbuf);
/// <summary>
/// 在标签中打印中文,此函数將中文变更标签能识别的像素字符
/// </summary>
/// <param name=”strChinese”>中文字符</param>
/// <returns></returns>
public static string GetChineseString(string strChinese)
{
StringBuilder sb = new StringBuilder(10240);
int i = GETFONTHEX(strChinese, “宋体”, 0, 14, 0, 1, 0, sb);
return sb.ToString().Substring(0, i);

}

}

Pls call me CPP.
Posts created 150

发表评论

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top