我正在尝试使用barcode4J的pdf417bean类将二进制数据转换为pdf417条形码。但它给了我以下错误
java.lang.IllegalArgumentException:检测到不可编码的字符:Í(Unicode:205) org.krysalis.barcode4j.impl.pdf417.PDF417HighLevelEncoder.determineConsecutiveBinaryCount(PDF417HighLevelEncoder.java:468) org.krysalis.barcode4j.impl.pdf417.PDF417HighLevelEncoder.encodeHighLevel(PDF417HighLevelEncoder.java:108) org.krysalis.barcode4j.impl.pdf417.PDF417LogicImpl.generateBarcodeLogic(PDF417LogicImpl.java:193) org.krysalis.barcode4j.impl.pdf417.PDF417Bean.generateBarcode(PDF417Bean.java:79) com.pb.iop.labelgen.impl.BarcodeService.generateBarcodecodePDF417(BarcodeService.java:244) sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:165) com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67) com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:276) com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133) com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83) com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133) com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1171) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1103) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1053) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1043) com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:406) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:477) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
这是我正在使用的代码库的一部分
PDF417Bean bean = new PDF417Bean();
bean.doQuietZone(true);
bean.setModuleWidth(UnitConv.in2mm(moduleWidthInches));
bean.setQuietZone(UnitConv.in2mm(quietZoneInches));
bean.setBarHeight(height);
boolean antiAlias = false;
int orientation = 0;
BitmapCanvasProvider canvas = new BitmapCanvasProvider(
dpi, BufferedImage.TYPE_BYTE_BINARY, antiAlias, orientation);
indiciaData = indiciaData.replaceAll("\\s+", "");
byte[] binaryData = Base64.decodeBase64(indiciaData.getBytes());
String base64DecodedMsg = StringUtils.newStringIso8859_1(binaryData);
bean.generateBarcode(canvas, base64DecodedMsg);
canvas.finish();
String mime = MimeTypes.MIME_BMP;
out = new ByteArrayOutputStream();
final BitmapEncoder encoder = BitmapEncoderRegistry.getInstance(mime);
encoder.encode(canvas.getBufferedImage(), out, mime, dpi);
我正在使用 apache commons 从 base 64 进行转换