|
|
@ -64,10 +64,13 @@ public final class QrCodeGeneratorDemo {
|
|
|
|
ImageIO.write(img, "png", imgFile); // Write image to file
|
|
|
|
ImageIO.write(img, "png", imgFile); // Write image to file
|
|
|
|
|
|
|
|
|
|
|
|
String svg = qr.toSvgString(4); // Convert to SVG XML code
|
|
|
|
String svg = qr.toSvgString(4); // Convert to SVG XML code
|
|
|
|
try (Writer out = new OutputStreamWriter(
|
|
|
|
Writer out = new OutputStreamWriter(
|
|
|
|
new FileOutputStream("hello-world-QR.svg"),
|
|
|
|
new FileOutputStream("hello-world-QR.svg"),
|
|
|
|
StandardCharsets.UTF_8)) {
|
|
|
|
StandardCharsets.UTF_8);
|
|
|
|
|
|
|
|
try {
|
|
|
|
out.write(svg); // Create/overwrite file and write SVG data
|
|
|
|
out.write(svg); // Create/overwrite file and write SVG data
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
try { out.close(); } catch (IOException e) { }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|