Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to re-size the text generated by Barbecue API?

I am trying to generate a barcode using the Barbecue API. The problem i am facing is that while i try to re-size the barcode the code in textual form which is printed below the barcode remains the same size. I need to decrease its side also. I have tried the following code :

Part 1:Original Size Barcode

Barcode b = BarcodeFactory.create2of7("4561");
b.setBarHeight(5);
b.setBarWidth(1);
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(b);
if (job.printDialog())
{
        job.print();
}

Part 2: Code for resizing

Barcode b = BarcodeFactory.create2of7("4561");
b.setBarHeight(5);
b.setBarWidth(1);
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(b);
if (job.printDialog())
{
job.print();
}

Below is the output image of the barcode:

Output of both the parts

As you can see the code remains the same size. How can i decrease its size? Please help me out.

Thanks.

like image 699
Nitesh Verma Avatar asked Dec 07 '25 13:12

Nitesh Verma


1 Answers

Barcode b;

b.setFont(null);

This would help you get the font size to 0.

like image 63
testTechie Avatar answered Dec 10 '25 01:12

testTechie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!