zxing库jar包中找不到MatrixToImageWriter这个类了
时间: 2024-03-09 20:49:46 浏览: 70
从zxing 3.0版本开始,MatrixToImageWriter这个类已经被移除了,官方文档也建议使用新的方法进行二维码的生成。新的方法是使用BitMatrix配合BufferedImage生成二维码图片,代码如下:
```java
BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, width, height);
BufferedImage image = MatrixToImageWriter.toBufferedImage(bitMatrix);
```
其中,content是要生成二维码的内容,width和height分别表示生成的二维码图片的宽度和高度。生成的二维码图片可以通过BufferedImage保存到本地或者直接输出到页面中。
相关问题
ZXing的EncodeHintType类里面找不到MAXICODE类型
MAXICODE是一种二维码格式,但它不是ZXing库中默认支持的格式之一。因此,在ZXing的EncodeHintType类中是找不到MAXICODE类型的。
如果需要生成MAXICODE格式的二维码,可以使用其他的库或工具,例如Zebra Crossing(ZXing)库的扩展版本:ZXing-JavaFX,它支持生成MAXICODE格式的二维码。
哪里可以下载zxing库jar包
你可以在zxing官网的下载页面下载zxing库的jar包:https://github.com/zxing/zxing/releases
在该页面中,你可以找到最新版本的zxing库,然后下载对应的jar包。如果你只需要使用zxing库的核心功能,可以下载名为"core-X.Y.Z.jar"的jar包。如果你需要使用zxing库的其他模块,比如zxing-android或zxing-javase等,可以下载相应的jar包。
下载完成后,将jar包添加到你的Java项目的classpath中即可使用zxing库。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)