導航:首頁 > 編程語言 > javabarcode

javabarcode

發布時間:2023-06-27 03:37:21

㈠ 怎麼樣用java生產ITF條形碼。。

Barcode4J由Java語言編寫而成,可以靈活的生成條形碼。它採用Apache License V2.0許可,這使得它很容易在商業中被使用。它可以讓您生成各種流行的一維和二維條碼,包括DataMatrix 和 PDF417。以各種格式輸出,包括SVG, EPS, bitmaps和Java2D,同樣也可根據您的需要添加自己的輸出格式。它為各種應用提供了插件,包括最重要的Apache FOP(格式對象處理器)。

㈡ java生成條形碼的問題,哪位高人知道barcode4j生成條形碼怎麼配置不顯示條形碼下邊的數字。

一維碼的話,加上hrp屬性:hrp=none,可以把數字欄去除。

src="<%=request.getContextPath()%>/genbc?msg=123456&type=code128&fmt=jpeg&hrp=none"

㈢ java如何驅動條形碼列印機並能實現WEB列印

參考 javax.print.*

大致過程是這樣的:
寫一個servlet,專門實現列印服務

這個servlet內是這樣處理的:
1.獲取列印機對象printer
通過枚舉 PrintService printservices[] = PrintServiceLookup.lookupPrintServices(...)

2.生成DocPrintJob job=PrintService.createPrintJob();

3.生成文檔 Doc doc = new SimpleDoc(...);
需要3個參數
第一個是列印的數據,可以根據條碼,生成一幅圖像,然把圖像作為輸入流,作為第一個參數
第二個參數用一個 DocFlavor.INPUT_STREAM 對象
DocFlavor類有相應的靜態變數,你根據圖像的mime類型選擇
第三個參數是一個DocAttributeSet對象
4.列印
job.print(doc, pras);

這是我以前寫的練習:
-----------------------------------------------------------------------
package printtest;

import java.io.*;
import javax.print.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;

public class Application1
{
public static void test(String code)
{
try{
DocFlavor flavor=DocFlavor.INPUT_STREAM.JPEG;

//get a printer
PrintService[] printers=PrintServiceLookup.lookupPrintServices( flavor, null);
for( int i=0; i<printers.length; i++ ) System.out.println( printers[i].getName());
PrintService printer=printers[0];

//job
DocPrintJob job=printer.createPrintJob();

//document
BufferedImage img=new BufferedImage( 400,300, BufferedImage.TYPE_USHORT_555_RGB );
Graphics g=img.getGraphics();
g.drawString(code, 100,100);
ByteArrayOutputStream outstream=new ByteArrayOutputStream();
ImageIO.write( img, "jpg", outstream);
byte[] buf=outstream.toByteArray();
InputStream stream=new ByteArrayInputStream(buf);
Doc doc=new SimpleDoc(stream,flavor,null);

//print
job.print(doc, null);
}
catch(Exception e)
{
e.printStackTrace();
}
}
//Main method
public static void main(String[] args)
{
test("12345");
}
}

㈣ 求Java大神給個代碼!計算驗證條形碼

public class Ean13Barcode {

private String code;

public Ean13Barcode(String code) {
super();
this.code = code;
}

public String encode() {
if (null == code) {
return "";
}
char[] codes = code.toCharArray();
int sum = 0;
for (int i = 0; i < codes.length; i++) {
int num = codes[i] - '純御0';
if (isEven(num)) {
sum += num;
} else {
sum += num * 3;
}
}
int x = sum % 10;
return code + (x == 0 ? 0 : 10 - x);
}

private boolean isEven(int x) {
return x % 2 == 0;
}

public static void main(String[] args) {
System.out.println(new Ean13Barcode("做配岩692223361219"賣悶).encode());
}

}

閱讀全文

與javabarcode相關的資料

熱點內容
方舟如何找自己玩過的伺服器手游 瀏覽:777
加密的方式選擇什麼呢 瀏覽:951
程序員居然不會自己敲代碼 瀏覽:78
pr編譯視頻怎麼改 瀏覽:639
附近密聊app如何 瀏覽:913
如何把app下到本地文件 瀏覽:929
代理伺服器不正確怎麼辦 瀏覽:772
ip地址和伺服器有什麼區別 瀏覽:458
程序員招聘中國 瀏覽:123
51單片機案例講解 瀏覽:18
明日方舟加密蝕刻章 瀏覽:705
linuxc計算時間差 瀏覽:388
加密程序公司哪家好 瀏覽:738
java目錄是否存在 瀏覽:983
程序員相親女教師視頻 瀏覽:727
貸款車在銀行怎麼解壓 瀏覽:879
威聯通應用數據在哪個文件夾 瀏覽:873
安卓驅動修改編譯 瀏覽:342
如何在klei里獲得伺服器 瀏覽:896
c語言編譯語法 瀏覽:830