fixed #6685: Fix QR code SVG saving

This commit is contained in:
Jaex 2023-01-18 03:40:45 +03:00
parent 2c2e1149d7
commit 55b15a4dd2

View file

@ -33,7 +33,7 @@
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using ZXing; using ZXing;
using ZXing.Common; using ZXing.QrCode;
using ZXing.Rendering; using ZXing.Rendering;
namespace ShareX namespace ShareX
@ -216,13 +216,14 @@ private void tsmiSaveAs_Click(object sender, EventArgs e)
if (filePath.EndsWith("svg", StringComparison.OrdinalIgnoreCase)) if (filePath.EndsWith("svg", StringComparison.OrdinalIgnoreCase))
{ {
BarcodeWriterSvg writer = new BarcodeWriterSvg BarcodeWriterSvg writer = new BarcodeWriterSvg()
{ {
Format = BarcodeFormat.QR_CODE, Format = BarcodeFormat.QR_CODE,
Options = new EncodingOptions Options = new QrCodeEncodingOptions()
{ {
Width = pbQRCode.Width, Width = pbQRCode.Width,
Height = pbQRCode.Height Height = pbQRCode.Height,
CharacterSet = "UTF-8"
} }
}; };
SvgRenderer.SvgImage svgImage = writer.Write(txtQRCode.Text); SvgRenderer.SvgImage svgImage = writer.Write(txtQRCode.Text);