0
如何設置固定寬度(500)和高度(300)條碼尺寸? 我正在使用Zxing庫來生成條形碼圖像。固定寬度和高度條碼PDF417格式
private byte[] GenerateBarCodeZXing(string data)
{
var writer = new BarcodeWriter
{
Format = BarcodeFormat.PDF_417,
Options = new EncodingOptions { Width = 500, Height = 300, Margin=0 }
};
var imgBitmap = writer.Write(data);
using (var stream = new MemoryStream())
{
imgBitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
return stream.ToArray();
}
}
輸出圖像:
你沒有提到你的代碼/結果有什麼問題。是不是500x300? – kennyzx
^圖像尺寸是500x300,但我希望條形碼尺寸相同。如果您查看上述兩張圖像,則會更改第二個圖像高度/寬度。我正在使用條形碼pdf_417生成PDF的Web應用程序。所有數據都是動態的,因此我希望條形碼在所有PDF中的大小相同。 –