barcodelib: Insufficient memory error
I’m using the bardcodelib to generate barcodes within PDFs by RDLC-Designer. If many people use our system at the same time, sometimes the PDF will be generated, but the barcode on it is missing and we got following error:
The definition of the report '' is invalid.
InnerException:
An unexpected error occurred in Report Processing.
InnerException:
Insufficient memory to continue the execution of the program.
Code snippet:
public byte[] GetBarCode39(string CodeNumber, int Lenght = 1000, int Height = 200, int FontSize = 40)
{
byte[] image = null;
try
{
MemoryStream ms = new MemoryStream();
Barcode barcode = new Barcode();
barcode.IncludeLabel = true;
barcode.Alignment = AlignmentPositions.CENTER;
barcode.LabelFont = new Font(FontFamily.GenericMonospace, FontSize, FontStyle.Regular);
var barcodeImage = barcode.Encode(TYPE.CODE39, CodeNumber, System.Drawing.Color.Black, System.Drawing.Color.White, Lenght, Height);
barcodeImage.Save(ms, ImageFormat.Jpeg);
image = ms.GetBuffer();
}
catch (Exception)
{
return null;
}
return image;
}
We already gave more power to the azure webservices, but this didn’t solve the problem… Do you know what’s the problem?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (14 by maintainers)
After:
You could use code like: