I have a question about printing additional information about barcodes. I use http://barbecue.sourceforge.net/ to create my barcodes.
After I created my barcodes, I want to add more information. At the moment, I am doing it as follows! For example:
Graphics2D g2d5 = container4Barcode.createGraphics(); g2d5.setBackground(Color.WHITE); g2d5.clearRect(0, 33, 200, 200); g2d5.setColor(Color.BLACK); g2d5.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d5.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP); g2d5.setFont(new Font("Arial", Font.PLAIN, 8)); g2d5.drawString(barcode, 8, 40); g2d5.drawString(generateRandomNumber(ekPreis), 57, 40); String datumResult = datum; g2d5.drawString(location, 98, 40); g2d5.drawString(datum.substring(2), 114, 40); g2d5.dispose();
The output is in pdf format: 
As you can see, the quality of my text (above and below the barcode) is really bad ... How to increase the quality of the text so that the text becomes smoother rather than pixel ?!
(When I print my barcodes, the barcodes look very pixelated ...)
Any tips?
UPDATE:
So, I added here a photo of my last result ... When I print these barcodes, they look awful! So here is the code I made:
Graphics2D g2d6 = container4Barcode.createGraphics(); g2d6.setColor(Color.black); g2d6.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d6.setFont(new Font("Verdana", Font.BOLD, 7)); g2d6.drawString("FLORETT", 9, 20); g2d6.drawString("50-521-60", 57, 20); Graphics2D g2d4 = container4Barcode.createGraphics(); g2d4.setColor(Color.black); g2d4.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d4.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); g2d4.setFont(new Font("Verdana", Font.BOLD, 11)); g2d4.drawString("SSYYS", 105, 19); g2d4.dispose();
With this code, I get the best results! Of course, I played with "Metrics, AA_GASP, LCS_HRGB, different fonts (Verdana is the best in my opinion) ..." and much more, but some of them I could not use, because then my barcode became blurry! Thus, I am raising the problem that I cannot improve the quality of the text quality of a drawstring from a 2D graphic!
So, I want to ask if it is possible to let "SSYYS" (font size 11) and "FLORETT" (font size 7) look much nicer! Is it possible in JAVA to draw "smooth" text on an image with a font size less than "12"? Is there a workaround to this? As you can see in the picture, the letters "S and Y" look very awful ...
Second update:
Some sample code is still ... Make sure the following folder exists: C: \ TestBarcodes \
I hope I have reduced my code to a minimum to imagine that my problem ...
package generator; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.io.FileOutputStream; import java.io.IOException; import net.sourceforge.barbecue.Barcode; import net.sourceforge.barbecue.BarcodeException; import net.sourceforge.barbecue.BarcodeFactory; import net.sourceforge.barbecue.output.OutputException; import org.apache.pdfbox.exceptions.COSVisitorException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg; import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage; public class BarcodeGen {
