C\#제3자 구성 요 소 를 통 해 QR 코드(QR 코드)와 바코드(Bar Code)생 성

C\#QR 코드 를 어떻게 생 성 하 는 지,우 리 는 기 존의 제3자 dll 을 통 해 직접 실현 할 수 있 습 니 다.다음은 몇 가지 서로 다른 생 성 방법 을 보 여 줍 니 다.
1):QrCodeNet(Gma.QrCodeNet.Encoding.dll)을 통 해 구현
1.1):먼저 VS 2015 의 NuGet 을 통 해 해당 하 는 제3자 구성 요 소 를 다운로드 합 니 다.아래 그림 과 같 습 니 다.

1.2):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

private void GenerateQRByQrCodeNet()
{
QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H);
QrCode qrCode = new QrCode();
qrEncoder.TryEncode("Hello World. This is Eric Sun Testing...", out qrCode);
GraphicsRenderer renderer = new GraphicsRenderer(new FixedModuleSize(5, QuietZoneModules.Two), Brushes.Black, Brushes.White);
using (MemoryStream ms = new MemoryStream())
{
renderer.WriteToStream(qrCode.Matrix, ImageFormat.Png, ms);
Image img = Image.FromStream(ms);
img.Save("E:/csharp-qrcode-net.png");
}
}
더 자세 한 정 보 는 다음 링크 를 참고 하 시기 바 랍 니 다.
https://www.jb51.net/article/99215.htm
http://qrcodenet.codeplex.com/
http://stackoverflow.com/questions/7020136/free-c-sharp-qr-code-generator
2):ThoughtWorks.QRcode(ThoughtWorks.QRcode.dll)를 통 해 구현
1.1):먼저 VS 2015 의 NuGet 을 통 해 해당 하 는 제3자 구성 요 소 를 다운로드 합 니 다.아래 그림 과 같 습 니 다.

1.2):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

private void GenerateQRByThoughtWorks()
{
QRCodeEncoder encoder = new QRCodeEncoder();
encoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;//    (  :BYTE     ,ALPHA_NUMERIC         )
encoder.QRCodeScale = 4;//  (               )
encoder.QRCodeVersion = 0;//  (  :   0                  )
encoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;//    、    ( 4   )
encoder.QRCodeBackgroundColor = Color.Yellow;
encoder.QRCodeForegroundColor = Color.Green;
string qrdata = "Hello   ! This is Eric Sun Testing....";
Bitmap bcodeBitmap = encoder.Encode(qrdata.ToString());
bcodeBitmap.Save(@"E:\HelloWorld.png", ImageFormat.Png);
bcodeBitmap.Dispose();
}
3):Spire.BarCode(Spire.BarCode.dll)를 통 해 구현
1.1):먼저 VS 2015 의 NuGet 을 통 해 해당 하 는 제3자 구성 요 소 를 다운로드 합 니 다.아래 그림 과 같 습 니 다.

1.2):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

private void GenerateQRBySpire()
{
BarcodeSettings bs = new BarcodeSettings()
{
Data = "This is qr code: H2AMK-Z3V69-RTJZD-C7JAU-WILL4",
Type = BarCodeType.QRCode,
TopTextColor = Color.Red,
ShowCheckSumChar = false,
ShowText = false
};
//Generate the barcode based on the this.barCodeControl1
BarCodeGenerator generator = new BarCodeGenerator(bs);
Image barcode = generator.GenerateImage();
//save the barcode as an image
barcode.Save(@"E:\barcode-2d.png");
}
1.3):구체 적 인 바코드 생 성 방법 은 다음 과 같다.

private void GenerateBarCodeBySpire()
{
BarcodeSettings bs = new BarcodeSettings()
{
Data = "This is barcode: H2AMK-Z3V69-RTJZD-C7JAU-WILL4",
ShowCheckSumChar = false,
TopTextColor = Color.Red,
ShowTopText = false,
ShowTextOnBottom = true
};
//Generate the barcode based on the this.barCodeControl1
BarCodeGenerator generator = new BarCodeGenerator(bs);
Image barcode = generator.GenerateImage();
//save the barcode as an image
barcode.Save(@"E:\barcode.png");
}
1.3):상소 코드 에서 우 리 는 생 성 된 바코드 와 QR 코드 에 워 터 마크[E-ICEBLUE]가 있 는 것 을 발 견 했 습 니 다.워 터 마크 를 어떻게 제거 합 니까?다음 코드 를 보십시오
BarcodeSettings.ApplyKey("......");
메 일 로 보 내 주세요[email protected] 에 대응 하 는 키 값 무료 획득
더 자세 한 정 보 는 다음 링크 를 참고 하 시기 바 랍 니 다.
http://freebarcode.codeplex.com/
http://www.e-iceblue.com/Knowledgebase/Spire.BarCode/Program-Guide/Programme-Guide-for-Spire.BarCode.html
https://www.jb51.net/article/99222.htm
4):바코드 렌 더 링 프레임 워 크(Zen.Barcode.Rendering.Framework.dll)를 통 해 구현
4.1):먼저 VS 2015 의 NuGet 을 통 해 해당 하 는 제3자 구성 요 소 를 다운로드 합 니 다.아래 그림 과 같 습 니 다.

4.2):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

private void GenerateBarCodeByZen()
{
Code128BarcodeDraw barcode128 = BarcodeDrawFactory.Code128WithChecksum;
Image img = barcode128.Draw("Hello World", 40);
img.Save("E:/zenbarcode.gif");
}
4.3):구체 적 인 바코드 생 성 방법 은 다음 과 같다.

private void GenerateQRByZen()
{
CodeQrBarcodeDraw qrcode = BarcodeDrawFactory.CodeQr;
Image img = qrcode.Draw("Hello World!", qrcode.GetDefaultMetrics(40));
img.Save("E:/zenqrcode.gif");
}
더 자세 한 정 보 는 다음 링크 를 참고 하 시기 바 랍 니 다.
http://barcoderender.codeplex.com/
5):BarcodeLib(BarcodeLib.Barcode.ASP.NET.NET.dll)을 통 해 구현 되 며,dll 에 대한 연결 을 다운로드 합 니 다.http://www.barcodelib.com/asp_net/
5.1):QR 코드 를 구체 적 으로 생 성 하 는 방법 은 다음 과 같다.

private void GenerateQRByBarcodeLib()
{
QRCode qrbarcode = new QRCode();
qrbarcode.Encoding = QRCodeEncoding.Auto;
qrbarcode.Data = "336699885522 This is Eric Sun Testing.";
qrbarcode.ModuleSize = 10;
qrbarcode.LeftMargin = 8;
qrbarcode.RightMargin = 8;
qrbarcode.TopMargin = 8;
qrbarcode.BottomMargin = 8;
qrbarcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;
// Save QR Code barcode image into your system
qrbarcode.drawBarcode("E:/csharp-qrcode-lib.gif");
}
5.2):구체 적 인 바코드 생 성 방법 은 다음 과 같다.

private void GenerateLinearByBarcodeLib()
{
Linear barcode = new Linear();
barcode.Type = BarcodeType.CODE128;
barcode.Data = "CODE128";
// other barcode settings.
// save barcode image into your system
barcode.drawBarcode("E:/barcode.png");
}
우리 가 사용 하 는 것 은 시용 판(워 터 마크 가 있 는...)이 고 비용 을 지불 하 는 정품 입 니 다.상세 한 내용 은 다음 과 같은 링크 를 참고 하 시기 바 랍 니 다.
http://www.barcodelib.com/asp_net/
위 에서 말 한 것 은 편집장 이 여러분 에 게 소개 한 C\#제3자 구성 요 소 를 통 해 QR 코드(QR Code)와 바코드(Bar Code)를 생 성 하 는 것 입 니 다.여러분 에 게 도움 이 되 기 를 바 랍 니 다.궁금 한 점 이 있 으 시 면 메 시 지 를 남 겨 주세요.편집장 은 신속하게 답 해 드 리 겠 습 니 다.여기 서도 저희 사이트 에 대한 여러분 의 지지 에 감 사 드 립 니 다!

좋은 웹페이지 즐겨찾기