Home Page Help / F.A.Q.
Home
Help
Ordering
Ordering FAQ
non CC payment
Technical Support
General (java)
RChart
RFax
RReport
RBarcode
RMail
RTree
RBarcode FAQ
  1. How to create a gif file?
  2. How to change the resolution of the printer.
  3. How to work with pixels instead of CM?
  4. How to use a servlet with Java[TM] platform 1.1 (also for RChart).
  5. How can I print a barcode
1. How to create a gif file with a Barcode?

This is an example:

public boolean CreateBarcode(String guid){
BarCode2D pdf417 = new BarCode2D();
pdf417.code="12345678901";
pdf417.barType=pdf417.PDF417;
pdf417.setSize(400,400);
barCodeEncoder c=new barCodeEncoder(pdf417,"JPEG","d:\\r2.JPG");
return true; }

 

2. How to change the resolution of the printer.

JDK 1.1 and 1.2 always print at a resolution of 72 dpi. With jdk 1.3 you can change the printer's resolution. See the java.awt.PageAttributes.setPrinterResosution() in the jdk1.3 documentation.

3. How to work with pixels instead of CM?

If you want to use pixels as measure unit instead of CM. You can do this:

youBarcode.resolution=1;

now all the units you use in RBarcode will be pixels, because 1 CM= 1 pixel.

 

4. How to use a servlet with jdk 1.1 (also for RChart).

The servlet needs Java[TM] platform version 1.2 because it uses a BufferedImage. In order to create an image using Java[TM] platform version 1.1. you cannot use BufferredImage.

This is how you can create an image using Java[TM] platform version 1.1:

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

But remember, the createImage() methods needs a VISIBLE COMPONENT, this a restiction in Java [TM] platform version 1.1 This means your servlet must have a visible frame or window.

 

5. How can I print a barcode

In order to print a Chart or a barcode you can:

In your Web applications:

  • if you use the applet, it will be printed when you print the HTML page from the browser. If has the following disadvantages:
    1. Browsers only print at a fixed resolution.
    2. Some browser versions (specialle IE) have problems when printing applets. You can only use this approach in a closed environment where you have control over the type of browser your users have.
  •  

  • if you use the servlet, the image will be printed when you print the HTML page from the browser.
    1. it will work on all browsers
    2. you can use the <IMG> tag to control the size of the image. For example: <IMG height=100 width=100 src="http://yourserver/examples/servlet/YourServlet">
    3. you need a Java[TM] enabled server

     

In your Java[TM] applications:

  • if you use our printing tool RReport you must create a Image object (and/or a gif/jpg file) that contains the chart. You can put this image in a Report.
  • if you use other printing tool you can always print images.