java 打印 string_java 控制打印机实现打印 String【】aa 字符串的数据

展开全部

/**

* 这是一部分代码

*/

package com.mqney.barcode.tsc.templet;

import ookj.ui.pub.messagedailog.MessageDailog;

import com.mqney.barcode.tsc.TscBarcode;

import com.mqney.barcode.tsc.TscClearbuffer;

import com.mqney.barcode.tsc.TscCloseport;

//import com.mqney.barcode.tsc.TscSendcommand;

import com.mqney.barcode.tsc.TscWindowsfont;

import com.mqney.barcode.tsc.impl.TscBarcodeDefault;

import com.mqney.barcode.tsc.impl.TscOpenportDefault;

import com.mqney.barcode.tsc.impl.TscPrintlabelDefault;

import com.mqney.barcode.tsc.impl.TscSetupDefault;

import com.mqney.barcode.tsc.impl.TscWindowsfontDefault;

import com.mqney.barcode.util.ReadTscProperties;

import com.mqney.barcode.util.RunTscDllFunction;

import com.mqney.barcode.util.TextToParagraph;

/**

* @author pinkfloyd

*

*/

public class SonqaoReportPrint {

public void init(SonqaoReportBean[] srbs){

try{if(srbs==null||srbs.length==0){

return;

}

int num = srbs.length;

/**

* DIRECTION可以,62616964757a686964616fe78988e69d8331333330326663RSS、CIRCLE不行。

*/

// TscSendcommand ts = new TscSendcommand("DIRECTION 1,1");

// TscSendcommand ts = new TscSendcommand("RSS 300,300,\"UCC128CCC\",270,2,2,25,\"1234567890|ABCDEFG\"");

// TscSendcommand ts = new TscSendcommand("CIRCLE 40,16,10,2");

// rdf.RunDllFunctionTSC(ts);

for(int i=0; i

SonqaoReportBean srb = srbs[i];

if(srb==null){

continue;

}

RunTscDllFunction rdf = new RunTscDllFunction();

TextToParagraph ttp = new TextToParagraph();

MessageDailog md = new MessageDailog();

TscOpenportDefault tod = new TscOpenportDefault();

ReadTscProperties rtp = new ReadTscProperties();

tod.setPrinter(rtp.getValue(ReadTscProperties.TSC_REPORT_PATH));

rdf.RunDllFunctionTSC(tod);

TscSetupDefault tsd = new TscSetupDefault();

tsd.setLabelWidth("100");

tsd.setLabelHeight("70");

rdf.RunDllFunctionTSC(tsd);

TscClearbuffer tcb = new TscClearbuffer();

rdf.RunDllFunctionTSC(tcb);

TscWindowsfontDefault twd;

twd = new TscWindowsfontDefault(40,16,36,"单位:");

twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);

rdf.RunDllFunctionTSC(twd);

twd = new TscWindowsfontDefault(40,88,36,"姓名:");

twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);

rdf.RunDllFunctionTSC(twd);

twd = new TscWindowsfontDefault(40,152,36,"信息:");

twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);

rdf.RunDllFunctionTSC(twd);

twd = new TscWindowsfontDefault(40,216,36,"部门:");

twd.setFontStyle(TscWindowsfont.FONT_STYLE_BOLD);

rdf.RunDllFunctionTSC(twd);

String[] s0 = ttp.textToParaVoid(srb.getGongsi(), 40);

if(s0==null||s0.length==0){

md.showWarningMessage("getGongsi");

}else{

int num0 = s0.length;

for(int j=0; j

twd = new TscWindowsfontDefault(140,16+(j*32),32,s0[j]);

// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);

rdf.RunDllFunctionTSC(twd);

}

}

twd = new TscWindowsfontDefault(140,80,40,srb.getXingming());

rdf.RunDllFunctionTSC(twd);

String[] s2 = ttp.textToParaVoid(srb.getXinxi(), 40);

if(s2==null||s2.length==0){

md.showWarningMessage("getXinxi");

}else{

int num2 = s2.length;

for(int j=0; j

twd = new TscWindowsfontDefault(140,152+j*32,32,s2[j]);

// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);

rdf.RunDllFunctionTSC(twd);

}

}

String[] s3 = ttp.textToParaVoid(srb.getBumen(), 40);

if(s3==null||s3.length==0){

md.showWarningMessage("getBumen");

}else{

int num3 = s3.length;

for(int j=0; j

twd = new TscWindowsfontDefault(140,216+j*32,32,s3[j]);

// twd.setFontUnderline(TscWindowsfont.FONT_UNDERLINE_WITH);

rdf.RunDllFunctionTSC(twd);

}

}

TscBarcodeDefault tbd;

tbd = new TscBarcodeDefault("216","360","48",srb.getBarcode());

tbd.setNarrowBarRatioX(TscBarcode.NARROW_BARRATIO_3);

tbd.setNarrowBarRatioY(TscBarcode.NARROW_BARRATIO_3);

rdf.RunDllFunctionTSC(tbd);

twd = new TscWindowsfontDefault(160,500,32,srb.getSonqao());

rdf.RunDllFunctionTSC(twd);

TscPrintlabelDefault tpd = new TscPrintlabelDefault();

tpd.setLabelCopies("1");

tpd.setLabelSets("1");

rdf.RunDllFunctionTSC(tpd);

TscCloseport tc = new TscCloseport();

rdf.RunDllFunctionTSC(tc);

}

}catch(Exception e){

e.printStackTrace();

}

}

}

本回答由提问者推荐

2Q==

已赞过

已踩过<

你对这个回答的评价是?

评论

收起

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值