KA.Barcode for Java
Guide for Resizing Code 39 Barcodes in Java
Complete Java source code to generate, print Code 39 images and change barcode size with Java Control
Code 39 Barcode Generator for Java Overview
  • Draw high-quality Code 39 barcodes in Java Class, J2SE applications by setting the size of barcode
  • Mature & Reliable Java Code 39 generation library with latest barcode symbology ISO Standards
  • Compatible with JSP,J2EE and other web projects
  • Royalty free with the purchase or Java Code 39 generator developer license
  • Easy to set bar module width(X), bar height(Y), image width and image height with Java Code 39
  • In addition, left margin, right margin, top margin, bottom margin, wide to narrow ratio and text margin can change the size of Code 39 image in Java projects
  • Code 39 barcode can be set in the center, right or left of the image
Related Code 39 Java Generation Setting Guide
Code 39 is also named as 3 of 9 Barcode, ASNI/AIM Code 39, USD-3, USS Code 39, Code 3/9, Code 3 of 9, USD-3, Code 39 Extended. Excluding Java Code 39 Size Setting, KeepAutomation provides other concerned Code 39 generation setting properties for adjust the image and encoding data:
Java Code 39 Size Setting Parameters
The size of Code 39 generated in Java can be adjusted with the following properties:
  • I - the width of spaces between characters in Code 39 (Float; Default: 1)
  • displayStartStopChar - to show the start and stop characters in the text under the barcode
  • WideNarrowRatio - represents the ratio of wide bars to narrow bars, which ranges from 2.0 to 3.0. Default is 2.0f
  • X - the width of the Code 39 bar module, default is 2 pixel
  • Y - the height value of Code 39 bar module, default is 75 pixel
  • UOM - Unit of measure for all size related properties. UOM_PIXEL (0); UOM_CM (1); UOM_INCH (2). Default is UOM_PIXEL (0)
  • leftMargin - the space between the left side and bars in Code 39 generated by Java Code 39
  • rightMargin - the space between the right side and bars in Code 39 generated by Java Code 39, default is 0
  • topMargin - the space between the top side and bars, default is 0
  • topMargin - the space between the top side and bars, default is 0
  • bottomMargin - the space between the bottom side and bars, default is 0
  • barcodeWidth - the fixed width value of Code 39 image, default is 0
  • barcodeHeight - the fixed height value of Code 39 image, default is 0
  • textFont - the text font style of the generated Code 39, default is new Font("Arial", Font.PLAIN, 11)
  • autoResize - adjust the size with your setting properties with set it to be ture
Code 39 Size Setting in Java - Common situations

Generate Code 39 image with a fixed Bar Width in Java

In java applications, Code 39 bar width can be set with the property - X. To set a fixed X, the Code 39 image will be printed with the minimum X.
  • Set the minimum value of X. For example, barcode.setX(4);
  • Set the autoResize to be false. For example,barcode.setautoReisize(false);
  • Adjust other option with your need

Create Code 39 image with a fixed Image Width in Java

In java applications, Code 39 image width can be set with the property - BarCodeWidth. To set a fixed image width, the Code 39 image will be drawn with the fixed image width.
  • Set the fixed value of BarCodeWidth. For example, barcode.setBarCodeWidth (200);
  • Set the autoResize to be true. For example,barcode.setautoReisize(true);
  • Adjust other option with your need

Draw Code 39 image with a Minimum X and BarCodeWidth in Java

In java applications, Code 39 image size can be changed with X and BarCodeWidth at the same time.
  • Set the minimum value of X. For example, barcode.setX(4);
  • Set the fixed value of BarCodeWidth. For example, barcode.setBarCodeWidth (200);
  • Set the autoResize to be false. For example,barcode.setautoReisize(false);
  • Adjust other option with your need
Note that, once setting a fixed X, a minimum BarCodeWidth Code 39 image is automatically created in Java. If your set BarCodeWidth is smaller than the minimum value, the generated Code 39 image width will be the minimum barcode width value in java. This situation is the same as BarCodeHeight.