Barcode Fonts, Components, ActiveX and .NET Windows Forms Controls, Java Servlets, 
DLLs and Barcode Scanners. IDAutomation.com, Inc., Computers Hardware, Software & Services, Tampa, FL   This site chose the Norton Secured Seal to promote trust online with consumers.    View your cart in the IDAutomation Store   


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

Solution(s):

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();
MYBARCODE.paint(imgGraphics);
// paint barcode
barCodeEncoder encoder = new barCodeEncoder(image,outb);
// encode the barcode as jpeg and send it
encoder.encode();

Related Documents:
 ©Copyright 2017 IDAutomation.com, All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us

Training Videos on YouTube  Join us on Google Plus  Join us on LinkedIn  Follow us on Twitter  Like us on Facebook
Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.