com.aspose.words

Class BarcodeParameters

  • java.lang.Object
    • com.aspose.words.BarcodeParameters
public class BarcodeParameters 
extends java.lang.Object

Container class for barcode parameters to pass-through to BarcodeGenerator.
The set of parameters are according to DISPLAYBARCODE field options. See the exact list at

Example:

Shows how to create barcode images using a barcode generator.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());

// Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());

// Configure barcode parameters for a QR barcode
BarcodeParameters barcodeParameters = new BarcodeParameters();
barcodeParameters.setBarcodeType("QR");
barcodeParameters.setBarcodeValue("ABC123");
barcodeParameters.setBackgroundColor("0xF8BD69");
barcodeParameters.setForegroundColor("0xB5413B");
barcodeParameters.setErrorCorrectionLevel("3");
barcodeParameters.setScalingFactor("250");
barcodeParameters.setSymbolHeight("1000");
barcodeParameters.setSymbolRotation("0");

// Save the generated barcode image to the file system
BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));

// Insert the image into the document
builder.insertImage(img);

// Configure barcode parameters for a EAN13 barcode
barcodeParameters = new BarcodeParameters();
barcodeParameters.setBarcodeType("EAN13");
barcodeParameters.setBarcodeValue("501234567890");
barcodeParameters.setDisplayText(true);
barcodeParameters.setPosCodeStyle("CASE");
barcodeParameters.setFixCheckDigit(true);

img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
builder.insertImage(img);

// Configure barcode parameters for a CODE39 barcode
barcodeParameters = new BarcodeParameters();
barcodeParameters.setBarcodeType("CODE39");
barcodeParameters.setBarcodeValue("12345ABCDE");
barcodeParameters.setAddStartStopChar(true);

img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
builder.insertImage(img);

// Configure barcode parameters for an ITF14 barcode
barcodeParameters = new BarcodeParameters();
barcodeParameters.setBarcodeType("ITF14");
barcodeParameters.setBarcodeValue("09312345678907");
barcodeParameters.setCaseCodeStyle("STD");

img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
builder.insertImage(img);

doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");

Constructor Summary
 
Property Getters/Setters Summary
booleangetAddStartStopChar()
void
setAddStartStopChar(booleanvalue)
           Whether to add Start/Stop characters for barcode types NW7 and CODE39.
java.lang.StringgetBackgroundColor()
void
setBackgroundColor(java.lang.Stringvalue)
           Bar code background color (0x000000 - 0xFFFFFF)
java.lang.StringgetBarcodeType()
void
setBarcodeType(java.lang.Stringvalue)
           Bar code type.
java.lang.StringgetBarcodeValue()
void
setBarcodeValue(java.lang.Stringvalue)
           Data to be encoded.
java.lang.StringgetCaseCodeStyle()
void
setCaseCodeStyle(java.lang.Stringvalue)
           Style of a Case Code for barcode type ITF14. The valid values are [STD|EXT|ADD]
booleangetDisplayText()
void
setDisplayText(booleanvalue)
           Whether to display barcode data (text) along with image.
java.lang.StringgetErrorCorrectionLevel()
void
setErrorCorrectionLevel(java.lang.Stringvalue)
           Error correction level of QR Code. Valid values are [0, 3].
java.lang.StringgetFacingIdentificationMark()
void
setFacingIdentificationMark(java.lang.Stringvalue)
           Type of a Facing Identification Mark (FIM).
booleangetFixCheckDigit()
void
setFixCheckDigit(booleanvalue)
           Whether to fix the check digit if it’s invalid.
java.lang.StringgetForegroundColor()
void
setForegroundColor(java.lang.Stringvalue)
           Bar code foreground color (0x000000 - 0xFFFFFF)
booleanisBookmark()
void
isBookmark(booleanvalue)
           Whether PostalAddress is the name of a bookmark.
booleanisUSPostalAddress()
void
isUSPostalAddress(booleanvalue)
           Whether PostalAddress is a U.S. postal address.
java.lang.StringgetPosCodeStyle()
void
setPosCodeStyle(java.lang.Stringvalue)
           Style of a Point of Sale barcode (barcode types UPCA|UPCE|EAN13|EAN8). The valid values (case insensitive) are [STD|SUP2|SUP5|CASE].
java.lang.StringgetPostalAddress()
void
setPostalAddress(java.lang.Stringvalue)
           Barcode postal address.
java.lang.StringgetScalingFactor()
void
setScalingFactor(java.lang.Stringvalue)
           Scaling factor for the symbol. The value is in whole percentage points and the valid values are [10, 1000].
java.lang.StringgetSymbolHeight()
void
setSymbolHeight(java.lang.Stringvalue)
           Bar code image height (in twips - 1/1440 inches)
java.lang.StringgetSymbolRotation()
void
setSymbolRotation(java.lang.Stringvalue)
           Rotation of the barcode symbol. Valid values are [0, 3].
 

    • Constructor Detail

      • BarcodeParameters

        public BarcodeParameters()
    • Property Getters/Setters Detail

      • getAddStartStopChar/setAddStartStopChar

        public boolean getAddStartStopChar() / public void setAddStartStopChar(boolean value)
        
        Whether to add Start/Stop characters for barcode types NW7 and CODE39.

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getBackgroundColor/setBackgroundColor

        public java.lang.String getBackgroundColor() / public void setBackgroundColor(java.lang.String value)
        
        Bar code background color (0x000000 - 0xFFFFFF)

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getBarcodeType/setBarcodeType

        public java.lang.String getBarcodeType() / public void setBarcodeType(java.lang.String value)
        
        Bar code type.

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getBarcodeValue/setBarcodeValue

        public java.lang.String getBarcodeValue() / public void setBarcodeValue(java.lang.String value)
        
        Data to be encoded.

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getCaseCodeStyle/setCaseCodeStyle

        public java.lang.String getCaseCodeStyle() / public void setCaseCodeStyle(java.lang.String value)
        
        Style of a Case Code for barcode type ITF14. The valid values are [STD|EXT|ADD]

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getDisplayText/setDisplayText

        public boolean getDisplayText() / public void setDisplayText(boolean value)
        
        Whether to display barcode data (text) along with image.

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getErrorCorrectionLevel/setErrorCorrectionLevel

        public java.lang.String getErrorCorrectionLevel() / public void setErrorCorrectionLevel(java.lang.String value)
        
        Error correction level of QR Code. Valid values are [0, 3].

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getFacingIdentificationMark/setFacingIdentificationMark

        public java.lang.String getFacingIdentificationMark() / public void setFacingIdentificationMark(java.lang.String value)
        
        Type of a Facing Identification Mark (FIM).

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getFixCheckDigit/setFixCheckDigit

        public boolean getFixCheckDigit() / public void setFixCheckDigit(boolean value)
        
        Whether to fix the check digit if it’s invalid.

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getForegroundColor/setForegroundColor

        public java.lang.String getForegroundColor() / public void setForegroundColor(java.lang.String value)
        
        Bar code foreground color (0x000000 - 0xFFFFFF)

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • isBookmark/isBookmark

        public boolean isBookmark() / public void isBookmark(boolean value)
        
        Whether PostalAddress is the name of a bookmark.

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • isUSPostalAddress/isUSPostalAddress

        public boolean isUSPostalAddress() / public void isUSPostalAddress(boolean value)
        
        Whether PostalAddress is a U.S. postal address.

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getPosCodeStyle/setPosCodeStyle

        public java.lang.String getPosCodeStyle() / public void setPosCodeStyle(java.lang.String value)
        
        Style of a Point of Sale barcode (barcode types UPCA|UPCE|EAN13|EAN8). The valid values (case insensitive) are [STD|SUP2|SUP5|CASE].

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getPostalAddress/setPostalAddress

        public java.lang.String getPostalAddress() / public void setPostalAddress(java.lang.String value)
        
        Barcode postal address.

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getScalingFactor/setScalingFactor

        public java.lang.String getScalingFactor() / public void setScalingFactor(java.lang.String value)
        
        Scaling factor for the symbol. The value is in whole percentage points and the valid values are [10, 1000].

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getSymbolHeight/setSymbolHeight

        public java.lang.String getSymbolHeight() / public void setSymbolHeight(java.lang.String value)
        
        Bar code image height (in twips - 1/1440 inches)

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");
      • getSymbolRotation/setSymbolRotation

        public java.lang.String getSymbolRotation() / public void setSymbolRotation(java.lang.String value)
        
        Rotation of the barcode symbol. Valid values are [0, 3].

        Example:

        Shows how to create barcode images using a barcode generator.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Assert.assertNull(doc.getFieldOptions().getBarcodeGenerator());
        
        // Barcodes generated in this way will be images, and we can use a custom IBarcodeGenerator implementation to generate them
        doc.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
        
        // Configure barcode parameters for a QR barcode
        BarcodeParameters barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("QR");
        barcodeParameters.setBarcodeValue("ABC123");
        barcodeParameters.setBackgroundColor("0xF8BD69");
        barcodeParameters.setForegroundColor("0xB5413B");
        barcodeParameters.setErrorCorrectionLevel("3");
        barcodeParameters.setScalingFactor("250");
        barcodeParameters.setSymbolHeight("1000");
        barcodeParameters.setSymbolRotation("0");
        
        // Save the generated barcode image to the file system
        BufferedImage img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.QR.jpg"));
        
        // Insert the image into the document
        builder.insertImage(img);
        
        // Configure barcode parameters for a EAN13 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("EAN13");
        barcodeParameters.setBarcodeValue("501234567890");
        barcodeParameters.setDisplayText(true);
        barcodeParameters.setPosCodeStyle("CASE");
        barcodeParameters.setFixCheckDigit(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.EAN13.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for a CODE39 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("CODE39");
        barcodeParameters.setBarcodeValue("12345ABCDE");
        barcodeParameters.setAddStartStopChar(true);
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.CODE39.jpg"));
        builder.insertImage(img);
        
        // Configure barcode parameters for an ITF14 barcode
        barcodeParameters = new BarcodeParameters();
        barcodeParameters.setBarcodeType("ITF14");
        barcodeParameters.setBarcodeValue("09312345678907");
        barcodeParameters.setCaseCodeStyle("STD");
        
        img = doc.getFieldOptions().getBarcodeGenerator().getBarcodeImage(barcodeParameters);
        ImageIO.write(img, "jpg", new File(getArtifactsDir() + "Field.BarcodeGenerator.ITF14.jpg"));
        builder.insertImage(img);
        
        doc.save(getArtifactsDir() + "Field.BarcodeGenerator.docx");