com.aspose.barcode.component

Class BarcodeGeneratorView

  • java.lang.Object
    • AppCompatImageView
      • com.aspose.barcode.component.BarcodeGeneratorView
  • All Implemented Interfaces:
    IBarCodeGeneratorControl


    public class BarcodeGeneratorView
    extends AppCompatImageView
    implements IBarCodeGeneratorControl
    BarCode Android View. Add aspose-barcode-android-*.aar to the project dependencies, and you will use BarcodeGeneratorView. Just add and customize the BarcodeGeneratorView to layout xml resource file. This sample shows how to use the BarcodeGeneratorView view in layout xml resource file.
         com.aspose.barcode.component.BarcodeGeneratorView
             android:id="@+id/barCodeGeneratorView"
             android:layout_width="300dp"
             android:layout_height="300dp"
             android:layout_marginLeft="45dp"
             android:background="@drawable/border"
             app:barcodeType="QR"
             app:codetext="sampletext"
             app:generateOnStart="true"
     
    • Constructor Detail

      • BarcodeGeneratorView

        public BarcodeGeneratorView(Context context)
        Initializes a new instance of the "BarCodeGeneratorControl" class.
      • BarcodeGeneratorView

        public BarcodeGeneratorView(Context context,
                                    AttributeSet attrs)
        Initializes a new instance of the "BarCodeGeneratorControl" class.
      • BarcodeGeneratorView

        public BarcodeGeneratorView(Context context,
                                    AttributeSet attrs,
                                    int defStyle)
        Initializes a new instance of the "BarCodeGeneratorControl" class.
    • Method Detail

      • dispose

        protected void dispose(boolean disposing)
        Releases resource.
        Parameters:
        disposing - true to release both managed and unmanaged resources; false to release only unmanaged resources.
      • onSizeChanged

        protected void onSizeChanged(int w,
                                     int h,
                                     int oldw,
                                     int oldh)
      • getCodeText

        public java.lang.String getCodeText()
        Data to be encoded, different types of BarCode may have different CodeText length restrictions.
      • setCodeText

        public void setCodeText(java.lang.String value)
        Data to be encoded, different types of BarCode may have different CodeText length restrictions.
      • getAutoSizeMode

        public AutoSizeMode getAutoSizeMode()
        Gets the mode by which the barcode automatically resizes. Default value is AutoSizeMode.NONE.
      • setAutoSizeMode

        public void setAutoSizeMode(AutoSizeMode value)
        Sets the mode by which the barcode automatically resizes. Default value is AutoSizeMode.NONE.
      • getCaptionAbove

        public CaptionUI getCaptionAbove()
        Caption Above the BarCode image. See .
      • getCaptionBelow

        public CaptionUI getCaptionBelow()
        Caption Above the BarCode image. See .
      • getXDimension

        public Unit getXDimension()
        X-dimension is the smallest width of the unit of BarCode bars or spaces. Increase this will increase the whole barcode image width. Ignored if property is set to AutoSizeMode.Nearest or AutoSizeMode.Interpolation.
      • getBarHeight

        public Unit getBarHeight()
        Height of 1D barcodes' bars. Ignored if property is set to AutoSizeMode.Nearest or AutoSizeMode.Interpolation.
      • getBarCodeHeight

        public Unit getBarCodeHeight()
        BarCode image height when property is set to AutoSizeMode.Nearest or AutoSizeMode.Interpolation.
      • getBarCodeWidth

        public Unit getBarCodeWidth()
        BarCode image width when property is set to AutoSizeMode.Nearest or AutoSizeMode.Interpolation.
      • getBarColor

        public int getBarColor()
        Bars color.
      • setBarColor

        public void setBarColor(int value)
        Bars color.
        Parameters:
        value -
      • getBarcodePaddings

        public Padding getBarcodePaddings()
        Gets Barcode paddings parameters .
        Returns:
      • getChecksumAlwaysShow

        public boolean getChecksumAlwaysShow()
        Always display checksum digit in the human readable text for Code128 and GS1Code128 barcodes.
      • setChecksumAlwaysShow

        public void setChecksumAlwaysShow(boolean value)
        Always display checksum digit in the human readable text for Code128 and GS1Code128 barcodes.
      • setChecksumEnabled

        public void setChecksumEnabled(EnableChecksum value)
        Enable checksum during generation 1D barcodes. Default is treated as Yes for symbology which must contain checksum, as No where checksum only possible. Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN, Codaba Checksum always used: Rest symbology
      • getEnableEscape

        public boolean getEnableEscape()
        Indicates whether explains the character "\" as an escape character in CodeText property. Used for Pdf417, DataMatrix, Code128 only If the EnableEscape is true, "\" will be explained as a special escape character. Otherwise, "\" acts as normal characters. Aspose.BarCode supports inputing decimal ascii code and mnemonic for ASCII control-code characters. For example, \013 and \\CR stands for CR.
      • setEnableEscape

        public void setEnableEscape(boolean value)
        Indicates whether explains the character "\" as an escape character in CodeText property. Used for Pdf417, DataMatrix, Code128 only If the EnableEscape is true, "\" will be explained as a special escape character. Otherwise, "\" acts as normal characters. Aspose.BarCode supports inputing decimal ascii code and mnemonic for ASCII control-code characters. For example, \013 and \\CR stands for CR.
      • getThrowExceptionWhenCodeTextIncorrect

        public boolean getThrowExceptionWhenCodeTextIncorrect()
        Only for 1D barcodes. If codetext is incorrect and value set to true - exception will be thrown. Otherwise codetext will be corrected to match barcode's specification. Exception always will be thrown for: Databar symbology if codetext is incorrect. Exception always will not be thrown for: AustraliaPost, SingapurePost, Code39Extended, Code93Extended, Code16K, Code128 symbology if codetext is incorrect.
      • setThrowExceptionWhenCodeTextIncorrect

        public void setThrowExceptionWhenCodeTextIncorrect(boolean value)
        Only for 1D barcodes. If codetext is incorrect and value set to true - exception will be thrown. Otherwise codetext will be corrected to match barcode's specification. Exception always will be thrown for: Databar symbology if codetext is incorrect. Exception always will not be thrown for: AustraliaPost, SingapurePost, Code39Extended, Code93Extended, Code16K, Code128 symbology if codetext is incorrect.
      • getWideNarrowRatio

        public float getWideNarrowRatio()
        Wide bars to Narrow bars ratio. Default value: 3, that is, wide bars are 3 times as wide as narrow bars. Used for ITF, PZN, PharmaCode, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, IATA2of5, VIN, DeutschePost, OPC, Code32, DataLogic2of5, PatchCode, Code39Extended, Code39Standard
        Returns:
        The WideNarrowRatio parameter value is less than or equal to 0.
      • setWideNarrowRatio

        public void setWideNarrowRatio(float value)
        Wide bars to Narrow bars ratio. Default value: 3, that is, wide bars are 3 times as wide as narrow bars. Used for ITF, PZN, PharmaCode, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, IATA2of5, VIN, DeutschePost, OPC, Code32, DataLogic2of5, PatchCode, Code39Extended, Code39Standard
        Parameters:
        value - The WideNarrowRatio parameter value is less than or equal to 0.
      • getCodeTextParameters

        public CodetextParametersUI getCodeTextParameters()
        Gets CodeText parameters .
      • getFilledBars

        public boolean getFilledBars()
        Gets a value indicating whether bars filled. Only for 1D barcodes.
      • setFilledBars

        public void setFilledBars(boolean value)
        Gets a value indicating whether bars filled. Only for 1D barcodes.
      • getBackgroundColor

        public int getBackgroundColor()
        Background color of the barcode image.
      • setBackgroundColor

        public void setBackgroundColor(int value)
        Background color of the barcode image.
      • getResolution

        public float getResolution()
        Gets the resolution of the BarCode image. One value for both dimensions. Default value: 96 dpi.
        Returns:
        The Resolution parameter value is less than or equal to 0.
      • setResolution

        public void setResolution(float value)
        Sets the resolution of the BarCode image. One value for both dimensions. Default value: 96 dpi.
        Parameters:
        value - The Resolution parameter value is less than or equal to 0.
      • getBorderParameters

        public BorderParameters getBorderParameters()
        Gets Border parameters .
      • getRotationAngle

        public float getRotationAngle()
        BarCode image rotation angle, measured in degree, e.g. RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle NOT equal to 90, 180, 270 or 0, it may increase the difficulty for the scanner to read the image.
        Specified by:
        getRotationAngle in interface IBarCodeGeneratorControl
      • setRotationAngle

        public void setRotationAngle(float value)
        BarCode image rotation angle, measured in degree, e.g. RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle NOT equal to 90, 180, 270 or 0, it may increase the difficulty for the scanner to read the image.
        Specified by:
        setRotationAngle in interface IBarCodeGeneratorControl