我有 Brother QL-700 标签打印机,并安装了上月底发布的最新 B-PAC SDK V3.2.001 64bit。我还在我的 Windows 10 64 位计算机上安装了“B-PAC 客户端组件”。给定的模板文件 (addr.LBX) 从 P-touch Editor 5.2 成功打印。
但是 B-Pac sdk 无法从 C# 程序下方打印。执行给定的代码片段时出现以下错误,
'NamePlt.vshost.exe' (CLR v2.0.50727: NamePlt.vshost.exe): Loaded 'C:\Program Files\Brother bPAC3 SDK\Samples\VCS\NamePlt\bin\Debug\Interop.bpac.dll'. Module was built without symbols.Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
任何支持高度赞赏!
private const string TEMPLATE_DIRECTORY = @"C:\Program Files\Brother bPAC3 SDK\Templates\"; // Template file path
private const string TEMPLATE_FILE = "addr.LBX"; // Template file printing fine from the P-touch Editor
public Form1()
{
InitializeComponent();
}
private void btnPrint_Click(object sender, EventArgs e)
{
string templatePath = TEMPLATE_DIRECTORY;
templatePath += TEMPLATE_FILE;
bpac.DocumentClass doc = new DocumentClass();
if (doc.Open(templatePath) != false)
{
//doc.GetObject("objCompany").Text = txtCompany.Text;
//doc.GetObject("objName").Text = txtName.Text;
// doc.SetMediaById(doc.Printer.GetMediaId(), true);
doc.StartPrint("", PrintOptionConstants.bpoDefault);
doc.PrintOut(1, PrintOptionConstants.bpoDefault);
doc.EndPrint();
doc.Close();
MessageBox.Show("Error code : " + doc.ErrorCode);
}
else
{
MessageBox.Show("Open() Error: " + doc.ErrorCode);
}
}