This is to update you that the generated barcode image must be in high resolution for optimal accuracy. The ideal resolution for recognition purposes is 300dpi and more. If the image has lower resolution than it may lead to scan failure.
Following your answer the value that must be applied is 300 dpi or more,How I can apply this value,I use:
BarCodeBuilder.setResolution (new Resolution (300, 300, ResolutionMode.Graphics));
What is the foinctionality of the ResolustionMode, Graphic or customized or pinter class?
How can i modify the dimension du barCode ??
builder.setAutoSize(true); ??
builder.setxDimension(2); xDimension Corresponds to the size of the image or the barcode??
builder.setyDimension(6); yDimension Corresponds to the size of the image or the barcode??
builder.setDisplay2DText(""); Display2DText ??
builder.setCodeLocation(CodeLocation.None); CodeLocation???
builder.setResolution(new Resolution(300, 300, ResolutionMode.Graphics));
builder.save(“Barcode.png”);
Thanks for your answer but I still do not understand this “ResolutionMode” mode to personalize the resolution can give me an examples to have a resolution 300dpi.
Please visit the link Customize Barcode Image Resolution for details. It is the simplest example to get barcode image of custom resolution. You can provide dpix, dpiy values of your choice. Currently the values are 200f, 400f in the example.
Furthermore following are the details regarding ResolutionMode enumeration:
Graphics: Apply the resolution of the barcode image according to the resolution of the specified Graphics object.
Value: 0
Customized: Apply the resolution of the barcode image according to the user defined DpiX and DpiY properties.
Value: 1
Printer: Apply the resolution of the barcode image according to the resolution of the specified printer.
We have evaluated the scenario at our end. We are unable to reproduce the issue. Sample code snippet to generate the barcode image and read the same barcode is attached for your reference.
CODE:
//Instantiate barcode object BarCodeBuilder bb = new BarCodeBuilder(); //Set the Code text for the barcode bb.setCodeText("1234567"); //Set the symbology type to code128 bb.setSymbologyType(com.aspose.barcode.Symbology.Code128);
bb.setCodeLocation(CodeLocation.Below); bb.setAutoSize(false); bb.setImageHeight(15); bb.setImageWidth(70); //Create an instance of resolution and apply on the barcode image with customized resolution settings bb.setResolution(new com.aspose.barcode.Resolution(300f, 300f, com.aspose.barcode.ResolutionMode.Graphics));
String sBarcodeImage = "barcode-image-resolution.png"; // Save the image bb.save(sBarcodeImage);
BarCodeReader reader = new BarCodeReader(sBarcodeImage);
while (reader.read()) { System.out.println(" codetext: " + reader.getCodeText()); } reader.close();
This is to update you that it is possible to add barcode image to MS Excel sheet. This can be done using Aspose.Cells APIs. Please post your inquiry to Aspose.Cells support forum along with sample code and sample barcode image to be added. My fellow colleague from Aspose.Cells support team will update you accordingly.