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 and Description |
---|
Margins(com.aspose.barcode.generation.Unit left,
com.aspose.barcode.generation.Unit right,
com.aspose.barcode.generation.Unit top,
com.aspose.barcode.generation.Unit bottom)
Initializes a new instance of the
Margins class with specified left, right, top, bottom marigns. |
Modifier and Type | Method and Description |
---|---|
com.aspose.barcode.generation.Unit |
getBottom()
Gets the
<b>bottom</b> marign in Unit value. |
com.aspose.barcode.generation.Unit |
getLeft()
Gets the
<b>left</b> margin in Unit value. |
com.aspose.barcode.generation.Unit |
getRight()
Gets the
<b>right</b> marign in Unit value. |
com.aspose.barcode.generation.Unit |
getTop()
Gets the
<b>top</b> marign in Unit value. |
java.lang.String |
toString()
Returns a String that represents the current
MarginsMargins instance. |
public Margins(com.aspose.barcode.generation.Unit left, com.aspose.barcode.generation.Unit right, com.aspose.barcode.generation.Unit top, com.aspose.barcode.generation.Unit bottom)
Initializes a new instance of the Margins
class with specified left, right, top, bottom marigns.
left
- The Left marign.right
- The right marign.top
- The top marign.bottom
- The bottom marign.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>
public com.aspose.barcode.generation.Unit getBottom()
Gets the <b>bottom</b>
marign in Unit
value.
public com.aspose.barcode.generation.Unit getLeft()
Gets the <b>left</b>
margin in Unit
value.
public com.aspose.barcode.generation.Unit getRight()
Gets the <b>right</b>
marign in Unit
value.
public com.aspose.barcode.generation.Unit getTop()
Gets the <b>top</b>
marign in Unit
value.
public java.lang.String toString()
Returns a String that represents the current MarginsMargins
instance.
toString
in class java.lang.Object
System.StringString
that represents the current Object.