Barcode label not shown for type PDF147 and QR

Hi,

We upgraded barcode version from 22.9 to 23.10 and we are facing the following problem. Before when we were creating a barcode type PDF147 and QR the label appeared on the bottom of the barcode. Now is not visible any more. For other types the label is visible.

Here is an example and i will attach also the barcode images as well:

	@Test
	public void testBarcodeNotGeneratingLabelForPdf147() throws Exception {
		SymbologyEncodeType symbologyValue = EncodeTypes.PDF_417;

		BarcodeGenerator barcodeGenerator = new BarcodeGenerator(symbologyValue);
		barcodeGenerator.setCodeText("0123456");

		
		barcodeGenerator.save("barcode_pdf147.jpg");
	}
	
	@Test
	public void testBarcodeGeneratingLabelForCode128() throws Exception {
		SymbologyEncodeType symbologyValue = EncodeTypes.CODE_128;

		BarcodeGenerator barcodeGenerator = new BarcodeGenerator(symbologyValue);
		barcodeGenerator.setCodeText("0123456");
		barcodeGenerator.save("barcode_code128.jpg");

	}

barcode_code128.jpg (6.1 KB)

barcode_pdf147.jpg (6.2 KB)

@Eleftheria_Stefanou,

Thanks for the details and barcode images.

After an initial testing, I am able to reproduce the issue as you mentioned. I found barcode label is not shown in the output image for type PDF147 and QR code, the label is displayed with CODE_128 type though.

We require thorough evaluation of your issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): BARCODEJAVA-1742

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

We changed behavior for 2D barcodes (I do not remember in which version). The label in default state is invisible. You can set it visible:

generator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.Below;

Thank you, i was able to see the labels with the suggestion you proposed.

@Eleftheria_Stefanou,

It is nice to know that your issue has been resolved by following the suggested line of code. Please feel free to write back to us if you have any further queries or comments. We will be happy to assist you soon.

@Eleftheria_Stefanou,

This is to inform you that your issue (logged earlier as “BARCODEJAVA-1742”) has been resolved. For 2D barcodes, the labels’ default state is set to visible now. The enhancement/fix will be included an upcoming release (hopefully, in Aspose.BarCode v24.2) that we plan to release in the next few days or before the end of this month. You will be notified when the next version is released.

Can you help a bit more please. If i want to change the font size how can i do it?
This line of code is not working:

>      barcodeGenerator.getParameters().getBarcode().getCodeTextParameters().getFont().getSize()
>                 .setPoint(15.0);

@Eleftheria_Stefanou,

By default, font mode is automatic, so when you specify the font size in code, it is ignored. You need to set font mode to MANUAL. See the following sample code that works as expected.
e.g.
Sample code:

com.aspose.barcode.generation.SymbologyEncodeType symbologyValue = com.aspose.barcode.generation.EncodeTypes.PDF_417;
com.aspose.barcode.generation.BarcodeGenerator barcodeGenerator = new com.aspose.barcode.generation.BarcodeGenerator(symbologyValue);
barcodeGenerator.getParameters().getBarcode().getCodeTextParameters().setLocation(com.aspose.barcode.generation.CodeLocation.BELOW);
barcodeGenerator.setCodeText("0123456");
barcodeGenerator.getParameters().getBarcode().getCodeTextParameters().setFontMode(FontMode.MANUAL);
barcodeGenerator.getParameters().getBarcode().getCodeTextParameters().getFont().getSize().setPoint(15.0f);
barcodeGenerator.save("f:\\files\\barcode_pdf147.jpg");

Hope, this helps a bit.

It worked the way you proposed. Thank you very much for the support.

@Eleftheria_Stefanou
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): BARCODENET-37531

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Eleftheria_Stefanou,

Good to know that your issue is sorted out by the suggested code segment. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.