public class Demo {
/**
* 根据自定义的内容和图片名称生成二维码图片
* 参考:https://blog.csdn.net/amberwangfeng/article/details/78657889
*/
public static void main(String[] args ){
String content = "http://api.sd-che.com:8080/ssm/fxck.html?"+"userId="+423+"&userType="+1;
String qRCodeName = "code/qRCode"+"PassengerId"+423+".png";
boolean flag = false;
int width = 300;
int height = 400;
String format = "png";
String text="分享时代分享经济";
int font = 10; //字体大小
int fontStyle = 1; //字体风格
//定义二维码的参数
HashMap hashMap = new HashMap();
hashMap.put(EncodeHintType.CHARACTER_SET, "utf-8");
hashMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
hashMap.put(EncodeHintType.MARGIN, 4);
try {
BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE
java生成二维码(带有logo和文字)
最新推荐文章于 2024-05-28 10:10:37 发布