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(Unit left,
Unit right,
Unit top,
Unit bottom)
Initializes a new instance of the
Margins class with specified left, right, top, bottom marigns. |
| 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. |
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.
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 Unit getBottom()
Gets the bottom marign in Unit value.
public Unit getLeft()
Gets the left margin in Unit value.
public Unit getRight()
Gets the right marign in Unit value.
public Unit getTop()
Gets the top marign in Unit value.
public java.lang.String toString()
Returns a String that represents the current MarginsMargins instance.
toString in class java.lang.ObjectSystem.StringString that represents the current Object.