copiado do note - diretorio de projeto desktop do netbenas

This commit is contained in:
2021-10-24 01:13:25 -03:00
commit 677cec6fed
508 changed files with 30644 additions and 0 deletions
@@ -0,0 +1,43 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.projeto.model;
/**
*
* @author Everton Luiz Kozloski - evertonkozloski@hotmail.com
// */
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.oned.EAN8Writer;
import com.google.zxing.qrcode.QRCodeWriter;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
public class QRCodeGenerator {
public void generateQRCodeImage(String text, int width, int height, String filePath)
throws WriterException, IOException {
QRCodeWriter qrCodeWriter = new QRCodeWriter();
BitMatrix bitMatrix = qrCodeWriter.encode(text, BarcodeFormat.QR_CODE, width, height);
Path path = FileSystems.getDefault().getPath(filePath);
MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path);
}
public void generateBarCodeImage(String text, int width, int height, String filePath)
throws WriterException, IOException {
EAN8Writer barCodeWriter = new EAN8Writer();
BitMatrix bitMatrix = barCodeWriter.encode(text, BarcodeFormat.EAN_8, width, height);
Path path = FileSystems.getDefault().getPath(filePath);
MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path);
}
}