使用以下代码生成条形码图像:
BufferedImage image = new BufferedImage(237, 140, BufferedImage.TRANSLUCENT);
JRGraphics2DExporter exporter = new JRGraphics2DExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, (Graphics2D)image.getGraphics());
exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, Float.valueOf((float) 2.35));
exporter.exportReport();
MasterDataBean masterDataBean = (MasterDataBean) ServiceFinder
.findBean("masterDataBean");
barcodePrint = masterDataBean.barcodePrintImage;
String path = barcodePrint + "barcode/";
File upFolder = new File(path);
if (!upFolder.exists()) {
upFolder.mkdirs();
}
String imagePath = path+ "barcode.png";
问题是
当我使用条形码打印机进行打印时,打印不清晰。但是,当我通过图像查看器打开该图像时,图像会清晰显示。
谁能帮助我解决此打印问题。我正在使用Java 1.6