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:\testlabel\testlabel.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 + "。\r\n" + DateTime.Now + "\r\n");
                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);

输出图片格式BARTENDER的更多相关文章

  1. canvas绘制圆图输出图片格式

    function drawCircleImage(url, callback) { const canvas = document.createElement('canvas'); const img ...

  2. MVC控制下输出图片、javascript与json格式

    /// <summary> /// 输出图片 /// </summary> /// <returns></returns> public ActionR ...

  3. C++ 输出PPM格式图片文件

    PPM简介 学习图形学时为了直观地观察结果,需要输出图片,而PPM是一种最简单的图片格式,非常适合新手使用. PPM文件的内容大概是这样的: 第一行固定为P3,代表写入的是PPM格式的RGB图像,除此 ...

  4. 如何让Ubuntu系统支持WebP图片格式

    本文主要向大家介绍如何让 Ubuntu 系统支持查看 WebP 图片格式,以及如何将 WebP 转为 JPEG 或 PNG 图片格式的方法. 什么是WebP图片 Google开发并推出 WebP 图片 ...

  5. java批量转换图片格式

    废话不多直接上代码,代码其实也不多.... package com.qiao.testImage; import java.awt.image.BufferedImage; import java.i ...

  6. Google最新的图片格式WEBP全面解析

    前言 不管是 PC 还是移动端,图片一直是流量大头,以苹果公司 Retina 产品为代表的高 PPI 屏对图片的质量提出了更高的要求,如何保证在图片的精细度不降低的前提下缩小图片体积,成为了一个有价值 ...

  7. 关于webp图片格式初探

    前言 不管是 PC 还是移动端,图片一直是流量大头,以苹果公司 Retina 产品为代表的高 PPI 屏对图片的质量提出了更高的要求,如何保证在图片的精细度不降低的前提下缩小图片体积,成为了一个有价值 ...

  8. LaTeX 中图片格式错误情况

    Unknown graphics extension: .eps 利用宏包usepackage {graphicx} 是图片和pdflatex一起用时的错误.注:{不是所有的时候,有时候也能通过} 两 ...

  9. Python 批量修改图片格式和尺寸

    公司的一个项目要求把所有4096x4096的图片全部转化成2048x2048的图片,这种批量转换图片大小的软件网上很多,我的同事原来使用的美图看看的批量转换,但是稍微有点麻烦,每次还需要指定要转换的图 ...

随机推荐

  1. ubuntu18.04 安装新版本openssl

    首先我们应该知道ubuntu18.04内置了1.1.0g版本的openssl: 使用下面的apt命令更新Ubuntu存储库并安装软件包编译的软件包依赖项: sudo apt update sudo a ...

  2. poj 2942 Knights of the Round Table - Tarjan

    Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress ...

  3. struts2 action中字符串转json对象出错 java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException

    commons-lang包有错,要么是引入错误,要么是没引入. 报不同错误,引入不同包. commons-beanutils-1.8.0.jar不加这个包 java.lang.NoClassDefFo ...

  4. 求最大流dinic算法模板

    //最短增广路,Dinic算法 struct Edge { int from,to,cap,flow; };//弧度 void AddEdge(int from,int to,int cap) //增 ...

  5. How to search for ? (question mark) in Excel

    The ? is a wildcard which represents a single character, and the * is a wildcard character that repr ...

  6. HDU 1465 不容易系列之一

    扯淡 貌似有傻逼的做法XD 话说我没开long long,忘读入n,忘了清零ans WA了三遍是什么操作啊 傻了傻了 思路 显然是一个错排问题啊XD 但是我们不套公式,我们用一发二项式反演 二项式反演 ...

  7. (转)awesome-text-summarization

    awesome-text-summarization 2018-07-19 10:45:13 A curated list of resources dedicated to text summari ...

  8. POJ 3087 Shuffle'm Up(洗牌)

    POJ 3087 Shuffle'm Up(洗牌) Time Limit: 1000MS    Memory Limit: 65536K Description - 题目描述 A common pas ...

  9. python bytes类型

    python3中二进制数据则由bytes类型表示,8位一字节 格式化打印文件的二进制编码 with open('spiderman.mkv', "rb") as f: print( ...

  10. FPGA 概述2

    参考1 参考2:浅论各种调试接口(SWD.JTAG.Jlink.Ulink.STlink)的区别 以下数据仅供参考 文章概要 主流FPGA厂商及产品 相同设计在FPGA与ASIC中耗费器件数量比较 F ...