We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with Background Color


We are facing a problem when using Aspose.BarCode for Java.

When we print the generated barcode, the background color is not totally white, but a little grey. It is not always the case, it depends on the printer we use.

It is a problem since it is not easy to decode a barcode with a grey background.

We try to put a transparent backcolor, but it seems that it doesn’t work, the backColor is always white, not transparent.

Here is the code we use to activate this transparent color :

BarCodeBuilder b = new BarCodeBuilder();

b.setBackColor(new Color (255, 255, 255, 0));


Have you got an idea to solve our problem?

This message was posted using Email2Forum by sheliah.


Thanks for considering Aspose.

The default background color of the barcode is white which should appear as white on the printer.

Could you please test any other program to print on that specific printer to check whether its printing grey for all prints.

Are you using awt or servlets? Could you also share some code snippet for printing the barcodes.

Yes, it is a problem with the printer, white background are grey when printing.
The only way to obtain a white background with this printer is to print a PNG image with a transparent background.

So my question is : Is it possible to generate a barcode with a transparent background using Aspose?

To print the barcode, we include it to a pdf file (using jasper) and then, we print the pdf.

Hi SBonvoisi,

What about barCodeBuilder.setBackColor(new Color(0,0,0,0)); or
barCodeBuilder.setBackColor(new Color(0,0,0,100));

Does this code works with your requirement?

Hi, sorry for the delay, i had a training period last week.

I’ve tried your solution but the generated barcode background was totally black, not transparent.

I’ve tried some other solutions :
- b.setBackColor(new Color(10,100,150)); => background color is blue
- b.setBackColor(new Color(10,100,150,255)); => exactly the same color (blue), 255 means full opaque, so this is working.
- b.setBackColor(new Color(10,100,150,0)); 0 means full transparent ==> background color is totally black and opaque

It seems that you can’t generate a transparent background color barcode with Aspose…

Any other ideas?


No responses, so no ideas?

Thanks for your support.

Hi SBonvoisi,

Our developers are still investigating at this issue and we will keep you update if any progress.