BarcodeParameters Class
Container class for barcode parameters to pass-through to BarcodeGenerator.
Inheritance Hierarchy
SystemObject
  Aspose.Words.FieldsBarcodeParameters

Namespace: Aspose.Words.Fields
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class BarcodeParameters

The BarcodeParameters type exposes the following members.

Constructors
  NameDescription
Public methodBarcodeParameters
Initializes a new instance of the BarcodeParameters class
Properties
  NameDescription
Public propertyCode exampleAddStartStopChar
Whether to add Start/Stop characters for barcode types NW7 and CODE39.
Public propertyCode exampleBackgroundColor
Bar code background color (0x000000 - 0xFFFFFF)
Public propertyCode exampleBarcodeType
Bar code type.
Public propertyCode exampleBarcodeValue
Data to be encoded.
Public propertyCode exampleCaseCodeStyle
Style of a Case Code for barcode type ITF14. The valid values are [STD|EXT|ADD]
Public propertyCode exampleDisplayText
Whether to display barcode data (text) along with image.
Public propertyCode exampleErrorCorrectionLevel
Error correction level of QR Code. Valid values are [0, 3].
Public propertyCode exampleFacingIdentificationMark
Type of a Facing Identification Mark (FIM).
Public propertyCode exampleFixCheckDigit
Whether to fix the check digit if it’s invalid.
Public propertyCode exampleForegroundColor
Bar code foreground color (0x000000 - 0xFFFFFF)
Public propertyCode exampleIsBookmark
Whether PostalAddress is the name of a bookmark.
Public propertyCode exampleIsUSPostalAddress
Whether PostalAddress is a U.S. postal address.
Public propertyCode examplePosCodeStyle
Style of a Point of Sale barcode (barcode types UPCA|UPCE|EAN13|EAN8). The valid values (case insensitive) are [STD|SUP2|SUP5|CASE].
Public propertyCode examplePostalAddress
Barcode postal address.
Public propertyCode exampleScalingFactor
Scaling factor for the symbol. The value is in whole percentage points and the valid values are [10, 1000].
Public propertyCode exampleSymbolHeight
Bar code image height (in twips - 1/1440 inches)
Public propertyCode exampleSymbolRotation
Rotation of the barcode symbol. Valid values are [0, 3].
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Remarks
The set of parameters are according to DISPLAYBARCODE field options. See the exact list at
Examples
Shows how to create barcode images using a barcode generator.
public void BarcodeGenerator()
{
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);

    Assert.IsNull(doc.FieldOptions.BarcodeGenerator);

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

    // Configure barcode parameters for a QR barcode
    BarcodeParameters barcodeParameters = new BarcodeParameters();
    barcodeParameters.BarcodeType = "QR";
    barcodeParameters.BarcodeValue = "ABC123";
    barcodeParameters.BackgroundColor = "0xF8BD69";
    barcodeParameters.ForegroundColor = "0xB5413B";
    barcodeParameters.ErrorCorrectionLevel = "3";
    barcodeParameters.ScalingFactor = "250";
    barcodeParameters.SymbolHeight = "1000";
    barcodeParameters.SymbolRotation = "0";

    // Save the generated barcode image to the file system
    System.Drawing.Image img = doc.FieldOptions.BarcodeGenerator.GetBarcodeImage(barcodeParameters);
    img.Save(ArtifactsDir + "Field.BarcodeGenerator.QR.jpg");

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

    // Configure barcode parameters for a EAN13 barcode
    barcodeParameters = new BarcodeParameters();
    barcodeParameters.BarcodeType = "EAN13";
    barcodeParameters.BarcodeValue = "501234567890";
    barcodeParameters.DisplayText = true;
    barcodeParameters.PosCodeStyle = "CASE";
    barcodeParameters.FixCheckDigit = true;

    img = doc.FieldOptions.BarcodeGenerator.GetBarcodeImage(barcodeParameters);
    img.Save(ArtifactsDir + "Field.BarcodeGenerator.EAN13.jpg");
    builder.InsertImage(img);

    // Configure barcode parameters for a CODE39 barcode
    barcodeParameters = new BarcodeParameters();
    barcodeParameters.BarcodeType = "CODE39";
    barcodeParameters.BarcodeValue = "12345ABCDE";
    barcodeParameters.AddStartStopChar = true;

    img = doc.FieldOptions.BarcodeGenerator.GetBarcodeImage(barcodeParameters);
    img.Save(ArtifactsDir + "Field.BarcodeGenerator.CODE39.jpg");
    builder.InsertImage(img);

    // Configure barcode parameters for an ITF14 barcode
    barcodeParameters = new BarcodeParameters();
    barcodeParameters.BarcodeType = "ITF14";
    barcodeParameters.BarcodeValue = "09312345678907";
    barcodeParameters.CaseCodeStyle = "STD";

    img = doc.FieldOptions.BarcodeGenerator.GetBarcodeImage(barcodeParameters);
    img.Save(ArtifactsDir + "Field.BarcodeGenerator.ITF14.jpg");
    builder.InsertImage(img);

    doc.Save(ArtifactsDir + "Field.BarcodeGenerator.docx");
}
See Also