zoukankan      html  css  js  c++  java
  • 输出图片格式BARTENDER

    try

                {
                    BarTender.Application btApp = new BarTender.Application();
                    BarTender.Format btFormat;
                    string tagTemplatesPath = Path.Combine(Application.StartupPath, "testlabel.btw");
                    btFormat = btApp.Formats.Open(tagTemplatesPath, false, "");//D: estlabel estlabel.btw


                    btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;  //设置同序列打印的份数


                    //btFormat.Databases.QueryPrompts.GetQueryPrompt(0);//根据数据库数据打印


                    //这个是序列化打印时使用的,当你的标签启动了序列化后,这个属性代表的就是打印的份数,譬如你的序列化初始数据是1,增量为1,NumberSerializedLabels设置为5,那么就会打印出1、2、3、4、5,五个标签出来。
                    //btFormat.PrintSetup.NumberSerializedLabels = 2;  //设置需要打印的序列数 




                    btFormat.SetNamedSubStringValue("Label_data01", DateTime.Now.ToString("HHmmss")); //向bartender模板传递变量
                    btFormat.PrintOut(false, false); //第二个false设置打印时是否跳出打印属性


                    //BarTender.Messages msg;
                    //int waitout = 10000; // 10秒 超时
                    //btFormat.Print("任务名1", true, waitout, out msg);//打印的任务名,是否等待打印完成,等待超时时间,打印过程输出的信息。


                    btFormat.Close(BarTender.BtSaveOptions.btSaveChanges); //退出时是否保存标签
                    btApp.Quit(BarTender.BtSaveOptions.btSaveChanges);//界面退出时同步退出bartender进程
                }
                catch (Exception ex)
                {
                    string path = Path.Combine(Application.StartupPath, "printlog.txt");
                    File.AppendAllText(path, "异常:" + ex.Message + "。 " + DateTime.Now + " ");
                    MessageBox.Show(ex.Message);

                }

    2.bartender导出图片

     BarTender.Format btFormat;
             BarTender.Application btApp;
             btFormat = new BarTender.Format();
             btApp = new BarTender.Application();

    string file = HttpContext.Current.Server.MapPath("/templatefile/testlabel.btw");
                btFormat = btApp.Formats.Open(file, false, "");
                btFormat.PrintSetup.NumberSerializedLabels = 1;
                btFormat.SetNamedSubStringValue("Label_data01",DateTime.Now.ToString("mmss"));

                btFormat.SaveAs(file, true);

                btFormat.ExportToFile(HttpContext.Current.Server.MapPath("/templatefile/BarCodeTable.jpg"), "jpg", BarTender.BtColors.btColors24Bit,              BarTender.BtResolution.btResolutionPrinter, BarTender.BtSaveOptions.btSaveChanges);
                Image1.ImageUrl = "~/templatefile/BarCodeTable.jpg";
                btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
                //打印
                btFormat = btApp.Formats.Open(file, false, "");
                //同一个条码,打印5个
                //btFormat.PrintSetup.IdenticalCopiesOfLabel = 5;   
                //条码递增+1
                //btFormat.PrintSetup.NumberSerializedLabels = 4;
                btFormat.PrintOut(false, false);
                btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

  • 相关阅读:
    error 65: access violation at 0x40021000 : no 'read' permission
    我的防Q+
    jquery judge element exist
    eclipse html 打开方式
    Java用JSoup组件提取asp.net webform开发网页的viewstate相关相关参数
    Chrome 启动参数列表
    Fixed the bug:while running alert/confirm in javascript the chrome freezes
    the confilict between validation and readonly in jquery
    Difference between prop and attr in different version of jquery
    Tomcat启动错误一例org.apache.catalina.core.StandardContext resources Start Error starting static Resources
  • 原文地址:https://www.cnblogs.com/qiu18359243869/p/10238550.html
Copyright © 2011-2022 走看看