Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when write a barcode with PureBarcode false. #391

Closed
dms-aping opened this issue Jan 12, 2022 · 1 comment
Closed

Exception when write a barcode with PureBarcode false. #391

dms-aping opened this issue Jan 12, 2022 · 1 comment
Assignees
Labels

Comments

@dms-aping
Copy link

            var writer = new BarcodeWriter<Bitmap>
            {
                Format = BarcodeFormat.CODE_128,
                Options = new Code128EncodingOptions
                {
                    Width = 0,
                    Height = 10,
                    PureBarcode = true,
                    Margin = 0,
                },
                Renderer = (IBarcodeRenderer<Bitmap>)new BitmapRenderer()
            };
            var bitmap = writer.Write("12345678");

It's ok.

When PureBarcode = false.
Exception throwed:
System.IndexOutOfRangeException:“Index was outside the bounds of the array.”

@micjahn
Copy link
Owner

micjahn commented Jan 14, 2022

The value of "Height" has to be at least the height of the font which is used for the content below the barcode.
For example, if you use a font with a height of 16 pixels you have to set Height = 16 at minimum.

I will provide a fix which prevent the output of the content below the code when the height of the image is too small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants