com.aspose.barcode.generation

Class Margins

  • java.lang.Object
    • com.aspose.barcode.generation.Margins


  • public final class Margins
    extends java.lang.Object

    Specifies the margins of a barcode image in Unit values.


      This sample shows how to create and save a BarCode image.
      
             BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.CODE_128);
             generator.getMargins().getLeft().setMillimeters(2);
             generator.getMargins().getTop().setPixels(15);
             generator.getMargins().getRight().setInches(0.3f);
             generator.getMargins().getBottom().setPoint(14);
             generator.save("test.png");
            


    <p>This class is used to manipulate margins in barcode image.</p>

    • Constructor Summary

      Constructors 
      Constructor and Description
      Margins(Unit left, Unit right, Unit top, Unit bottom)
      Initializes a new instance of the Margins class with specified left, right, top, bottom marigns.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Unit getBottom()
      Gets the bottom marign in Unit value.
      Unit getLeft()
      Gets the left margin in Unit value.
      Unit getRight()
      Gets the right marign in Unit value.
      Unit getTop()
      Gets the top marign in Unit value.
      java.lang.String toString()
      Returns a String that represents the current MarginsMargins instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Margins

        public Margins(Unit left,
                       Unit right,
                       Unit top,
                       Unit bottom)

        Initializes a new instance of the Margins class with specified left, right, top, bottom marigns.

        Parameters:
        left - The Left marign.
        right - The right marign.
        top - The top marign.
        bottom - The bottom marign.
        Throws:
        java.lang.IllegalArgumentException - <p>The left parameter value is less than 0.</p> <p>-or-</p> <p>The right parameter value is less than 0.</p> <p>-or-</p> <p>The top parameter value is less than 0.</p> <p>-or-</p> <p>The bottom parameter value is less than 0.</p>
    • Method Detail

      • getBottom

        public Unit getBottom()

        Gets the bottom marign in Unit value.

      • getLeft

        public Unit getLeft()

        Gets the left margin in Unit value.

      • getRight

        public Unit getRight()

        Gets the right marign in Unit value.

      • getTop

        public Unit getTop()

        Gets the top marign in Unit value.

      • toString

        public java.lang.String toString()

        Returns a String that represents the current MarginsMargins instance.

        Overrides:
        toString in class java.lang.Object
        Returns:
        A System.StringString that represents the current Object.