要調(diào)用Bartender的方法,首先需要將Bartender的COM對(duì)象添加到項(xiàng)目的引用中。然后可以使用以下代碼示例來實(shí)例化Bartender對(duì)象并調(diào)用其方法:
using Seagull.BarTender.Print;
// 創(chuàng)建Bartender應(yīng)用程序?qū)ο?/span>
Engine btEngine = new Engine();
btEngine.Start();
// 打開Bartender標(biāo)簽文件
LabelFormatDocument btFormat = btEngine.Documents.Open(@"C:\Path\To\Your\Label.btw");
// 打印標(biāo)簽
btFormat.PrintOut(false, false);
// 關(guān)閉Bartender標(biāo)簽文件并退出Bartender應(yīng)用程序
btFormat.Close(SaveOptions.DoNotSaveChanges);
btEngine.Stop();
在上面的示例中,我們首先創(chuàng)建了一個(gè)Bartender引擎對(duì)象,然后打開了一個(gè)Bartender標(biāo)簽文件,最后打印了標(biāo)簽并關(guān)閉了標(biāo)簽文件和Bartender應(yīng)用程序。您可以根據(jù)需要調(diào)用其他Bartender方法來實(shí)現(xiàn)更多功能。