问题描述
我正在Visual Studio 2012 RC中开发一个POS系统的C#应用程序.我必须使用
I am developing a C# application of POS system in Visual Studio 2012 RC. I have to print the sales on label printer using
Brothers P-Touch QL-500 标签打印机.
我已经做了什么.
- 我已经安装了最新的 b-pac SDK 3.0
- 成功添加对我的 C# 应用程序的引用.
- 为了创建标签模板,我安装了最新版本的 p-touch Editor 5.0.
制作了一个模板(Mylabel.lbl).
但在那之前.
我运行了一些内置示例,但这些示例引发异常.在 Google 上进行了大量搜索后,我发现这是打印机驱动程序问题.
I run some of the built in Examples but those examples Throws an Exception. After doing alot of search on Google I found that this is the printer's driver Problem.
我无法安装驱动程序,因为驱动程序的安装需要连接打印机.我没有打印机.
i can't install the driver because Driver's installation requires a printer to be connected. I DON'T HAVE THE PRINTER.
我需要做什么
- 您知道我该如何完成这项任务吗?
使用Brothers P-Touch QL-500标签打印机打印标签的正确方法是什么.
- Do you have any idea that how can i do this task.
what is the right way of printing a label using Brothers P-Touch QL-500 Label printer.
请帮助我我已经做了很多时间搜索.stackoverflow 是我最后的希望.我是这种标签打印的新手.请帮助我将不胜感激.
Please Help me I have done alot of time on searching. stackoverflow is my last hope. I am new to such label printing. Please help i will be greatly thankful.
我正在使用的 ruff 示例代码.
bpac.DocumentClass doc = new DocumentClass(); if (doc.Open("templateFile.lbx")) { doc.GetObject("field1").Text = "..."; doc.GetObject("field2").Text = "..."; doc.StartPrint("", PrintOptionConstants.bpoDefault); doc.PrintOut(1, PrintOptionConstants.bpoDefault); doc.EndPrint(); doc.Close(); }
这是我正在尝试的示例代码.第一行抛出异常
This is the example code which i am trying. the very first line throws an exception
bpac.DocumentClass doc = new DocumentClass();
我还附加了一个异常屏幕预览.
I am Also attaching a Exception Screen Preview.
推荐答案
发生异常时,我收到了完全相同的错误消息.我的解决方案是将平台目标"设置为X86"CPU.这可以通过以下方式完成:(菜单)项目->属性->(选项卡)构建->平台目标x86"而不是任何 CPU"
I had the exact same error message when the exception occurred. The solution for me was to set the "Platform target" to "X86" CPU. This can be done via: (menu) Project -> Properties -> (tab) Build -> Platform target "x86" Instead of "Any CPU"
我在 Windows 7 64 位上开发了该软件.
I have developed the software on Windows 7 64 bit.
您可以在 b-PAC SDK 文档中找到有关此的更多信息.C:Program Files (x86)Brother bPAC3 SDKDocPAC30_eng.chm在疑难解答"部分您会发现:程序无法在 64 位操作系统上运行.请将平台更改为x86",然后重新编译."
You can find more info about this in the b-PAC SDK documentation. C:Program Files (x86)Brother bPAC3 SDKDocPAC30_eng.chm In the section "Troubleshooting" you will find: "The program does not operate on a 64-bit operating system. Change the platform to "x86", and then recompile it."
此解决方案已使用连接到我的 PC 的 QL560 硬件进行测试,并且可以正常工作.
This solution is tested with the QL560 hardware connected to my PC and it worked.
这篇关于在 C# 应用程序中使用 b-pac SDK 进行标签打印开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!