i am making Barcodes in my Application using JsBarcode Plugin Code is something Like This
JsBarcode("#barcode", "1234", {
format: "CODE128",
lineColor: "#0aa",
width:4,
height:40,
displayValue: true
});
now the barcode is generating Correctly,When i print the label from label printer whose resolution is 203dpi is not able to print label clearly,When i choose Dithering 'none' in options it print label clearly and the labels are readble using my android phone application ,but not readble using any of barcode readers (i have tried with 4 to 5 readers).Searching here i came across this answer ,It suggests making a pdf file Now Problem with Pdf file is
When Printed ,Full page will be printed,if someone want to print single barcode it will not be feasible
And second answer i came across was this,it suggest printing using zebra printer,i have not been able to be clear with this and if someone will be using any other printer ,what solution should be done for him.
I am working with Java.
Finally able to read and write bar-codes successfully.
From Doing little research here is what i came to know about problem.
Problems
1. HTML is inconsistent and it shows different behavior screen to screen ,so it was not a good idea to print using HTML and JavaScript.
2. The image(Barcode) created using JavaScript and HTML was of Higher DIP which when printed on low resolution barcode printer not rendered properly.
Solution
OutputStream os=new ByteArrayOutputStream();
try{
Barcode barcode = BarcodeFactory.createCode128B(printLabel.getBagNo());
barcode.setBarWidth(1);
barcode.setResolution(203);
barcode.setBarHeight(1);
Font font=new Font("Plain",Font.PLAIN,8);
barcode.setFont(font);
//File f = new File("mybarcode.png");
// System.out.println(f.getAbsolutePath());
BarcodeImageHandler.writePNG(barcode, os);
//BarcodeImageHandler.savePNG(barcode, f);
}
catch (Exception e){
System.out.println(e.getMessage());
}