Unit

Unit class

Specifies the size value in different units (Pixel, Inches, etc.).

new Unit()

Example:

//This sample shows how to create and save a BarCode image.
   let generator = new BarcodeGenerator(EncodeTypes.CODE_128);
   generator.getParameters().getBarcode().getBarHeight().setMillimeters(10);
   generator.save("test.png", BarcodeImageFormat.PNG);

Methods

NameDescription
equals(obj)Determines whether this instance and a specified object, which must also be a Unit object, have the same value.
getDocument()Gets size value in document units.
getInches()Gets size value in inches.
getMillimeters()Gets size value in millimeters.
getPixels()Gets size value in pixels.
getPoint()Gets size value in point.
setDocument()Sets size value in document units.
setInches()Sets size value in inches.
setMillimeters()Sets size value in millimeters.
setPixels()Sets size value in pixels.
setPoint()Sets size value in point.
toString()Returns a human-readable string representation of this Unit.