java - Barbecue barcode generator does not show barcode number with a web app -
i tried barbecue barcode generator in stand alone java application , able print barcodes barcode number displayed in image.
but when execute same method spring web application, generated barcodes not show barcode number in below image. using same file path save images , have full rw permissions directory. have clue on this,
i using below code snippet
barcode = barcodefactory.createcode128a(barcode_id); file f = new file("/opt/rd/barcode/"+barcode_id+".png"); barcodeimagehandler.savepng(barcode, f);
i've fixed issue in grails setting font barcode , overwriting calculatesize() method in barcode:
private dimension calculatesize(){ dimension d = new dimension(); if(environmentfactory.getenvironment() instanceof headlessenvironment) try { if(font == null) { d = draw(new sizingoutput(font, getforeground(), getbackground()), 0, 0, barwidth, barheight); } else { java.awt.fontmetrics fontmetrics = getfontmetrics(font); d = draw(new sizingoutput(font, fontmetrics, getforeground(), getbackground()), 0, 0, barwidth, barheight); } } catch(outputexception e) { e.printstacktrace(); } else try { java.awt.fontmetrics fontmetrics = null; if(font != null) fontmetrics = getfontmetrics(font); d = draw(new sizingoutput(font, fontmetrics, getforeground(), getbackground()), 0, 0, barwidth, barheight); } catch(outputexception e) { } return d; }
this thread in sourceforge can shed more light on issue.
Comments
Post a Comment