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");
This class is used to manipulate margins in barcode image
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
- The left parameter value is less than 0.
-or-
The right parameter value is less than 0.
-or-
The top parameter value is less than 0
-or-
The bottom parameter value is less than 0
public Unit getBottom()
Gets the bottom
marign in Unit
value.
The Bottom parameter value is less than 0
public Unit getLeft()
Gets the left
margin in Unit
value.
The Left parameter value is less than 0
public Unit getRight()
Gets the right
marign in Unit
value.
The Right parameter value is less than 0
public Unit getTop()
Gets the top
marign in Unit
value.
The Top parameter value is less than 0
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.