pom配置

		<dependency>
		    <groupId>com.github.cloudecho</groupId>
		    <artifactId>qrcode</artifactId>
		    <version>1.0.0</version>
		</dependency>

  代码

 public static void main(String []args)throws Exception{   
        String text = "http://www.bing.com/knows/search?q=%E8%B0%B7%E6%AD%8C%E5%9C%B0%E5%9B%BE&mkt=zh-cn&FORM=BKACAI";   
        int width = 300;   
        int height = 300;   
        String format = "png";   
        Hashtable hints= new Hashtable();   
        hints.put(EncodeHintType.CHARACTER_SET, "utf-8");   
         BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height,hints);   
         File outputFile = new File("D:\\new.png");   
         MatrixToImageWriter.writeToFile(bitMatrix, format, outputFile);   
            
    }   

  

 

相关文章:

  • 2021-12-27
  • 2021-09-01
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-31
  • 2021-10-30
  • 2022-12-23
  • 2021-12-09
  • 2021-11-21
  • 2021-11-21
相关资源
相似解决方案