Will the Java Barcode Package create JPEG files in JDK 1.1?

Will the Java Barcode Package create JPEG files in JDK 1.1?

You are here:
< Back

The class for displaying the barcode in the Java Barcode Package uses calls from Graphics2D, inside java.awt package. This class is not available in JDK 1.1; therefore, JDK 1.2 must be used. If Java 1.1 is used, the Component.createImage() must be used to get an image and graphic context to draw on. However, this only works if the component is visible. In Java 1.1 a graphics context is only accessible for drawing with a compulsory visible component.

How to use the Servlet with Java 1.1.

The servlet requires Java 1.2 because it uses a BufferedImage. The BufferedImage cannot be used in Java 1.1 to create an image, the createImage() methods needs a visible component, which is a restriction in Java 1.1. Therefore, the servlet must have a visible frame or window. This is an example of what should be done to create an image using java 1.1. The following working code was provided by a developer, and is not supported by IDAutomation’s technical support team:

java.awt.Image image =COMPONENT.createImage(400,400 );
java.awt.Graphics imgGraphics = image.getGraphics();
// paint barcode
barCodeEncoder encoder = new barCodeEncoder(image,outb);
// encode the barcode as jpeg and send it