導航:首頁 > 編程語言 > 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相關的資料

熱點內容
德語小說pdf 瀏覽:123
陝西聯通dns伺服器地址 瀏覽:937
js表格即時編譯 瀏覽:302
51單片機串口拓展 瀏覽:305
重裝系統後加密圖片損壞 瀏覽:463
電腦怎麼放大縮小app窗口 瀏覽:523
教育十APP學校怎麼更改 瀏覽:821
空調外機壓縮機熱保護 瀏覽:754
winlinux雙系統卸載 瀏覽:239
如何對安卓應用反編譯 瀏覽:410
鯤鵬pc伺服器是什麼 瀏覽:572
一級防震梁箍筋加密 瀏覽:928
linuxxampp64位 瀏覽:728
西安哪個app能買到東西 瀏覽:457
eps命令鍵 瀏覽:38
塑料文件夾的尺寸 瀏覽:210
君威壓縮機電磁閥 瀏覽:945
安卓6手機為什麼不能用app 瀏覽:860
什麼java編譯器支持中文 瀏覽:564
香港伺服器如何做代理 瀏覽:201