728x90

 

 

public Stream ConvertImageStream(string text, int width = 300, int height = 300)

{

var barcodeWriter = new ZXing.Mobile.BarcodeWriter

{

Format = ZXing.BarcodeFormat.QR_CODE,

Options = new ZXing.Common.EncodingOptions

{

Width = width,

Height = height,

Margin = 10

}

};

 

barcodeWriter.Renderer = new ZXing.Mobile.BitmapRenderer();

var bitmap = barcodeWriter.Write(text);

var stream = new MemoryStream();

bitmap.Compress(Bitmap.CompressFormat.Png, 100, stream);

stream.Position = 0;

return stream;

}

 

 

728x90
Posted by kjun.kr
,