Free Support Forum - aspose.com

CaptionAbove and CaptionBelow don't work

Hello,
I’m using Aspose.Barcode 19.11 with regular licence.
I have this code:

dim barcode = New Aspose.BarCode.Generation.BarcodeGenerator(Aspose.BarCode.Generation.EncodeTypes.QR, “Hello Paul!”)
barcode.Parameters.Barcode.BarCodeWidth.Pixels = 200
barcode.Parameters.Barcode.BarCodeHeight.Pixels = 200
barcode.Parameters.Barcode.AutoSizeMode = Aspose.BarCode.Generation.AutoSizeMode.Nearest
barcode.Parameters.CaptionAbove.Visible = False
barcode.Parameters.CaptionBelow.Visible = False
barcode.Save(“D:\Temp\sample.jpg”, Aspose.BarCode.BarCodeImageFormat.Jpeg)

I noticed that barcode generated has caption below “Hello Paul!” even if I set “barcode.Parameters.CaptionBelow.Visible = False” false.

Why?
Thanks!

@matteofabris,

Thanks for the code segment and details.

Please change the lines of code:
i.e.,

barcode.Parameters.CaptionAbove.Visible = False
barcode.Parameters.CaptionBelow.Visible = False

with:
barcode.Parameters.Barcode.CodeTextParameters.Location = Aspose.BarCode.Generation.CodeLocation.None

it will work fine.

Also see the document for your reference:
https://docs.aspose.com/display/barcodenet/Working+with+BarCode+Text+Appearance

Hope, this helps a bit.

Ok thanks! It works!
Pay attention this documentation https://docs.aspose.com/display/barcodenet/Managing+Different+Barcode+Settings in section “Manage Barcode Caption” is misleading.

Bye

@matteofabris,

Good to know that the suggested line of code works for your needs.

We will evaluate it and figure it out soon.

@matteofabris,

We evaluated it further.
Well, you are mixing bar code text with bar code caption a bit. Both are two different things.
A barcode caption refers to customized (extra) information on the barcode image.
A barcode text is the original text/value based on which barcode is generated.

We set barcode caption using CaptionBelow.Text property and by default this CaptionBelow and CaptionAbove visibility is set to False. The solution which I provided is exactly what you are looking for as you need to hide code text and not caption.

Hope, this helps a bit.