Class Margins

  • All Implemented Interfaces:
    java.io.Serializable, javax.print.attribute.Attribute, javax.print.attribute.DocAttribute, javax.print.attribute.PrintJobAttribute, javax.print.attribute.PrintRequestAttribute

    public class Margins
    extends java.lang.Object
    implements javax.print.attribute.DocAttribute, javax.print.attribute.PrintRequestAttribute, javax.print.attribute.PrintJobAttribute
    Custom printing attribute to represent page margins.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Margins​(float top, float left, float right, float bottom)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)  
      float getBottom​(int units)  
      java.lang.Class<? extends javax.print.attribute.Attribute> getCategory()  
      float getLeft​(int units)  
      float[] getMargins​(int units)
      Get the margins as an array of 4 values in the order top, left, right, bottom.
      java.lang.String getName()  
      float getRight​(int units)  
      float getTop​(int units)  
      int hashCode()  
      java.lang.String toString()  
      java.lang.String toString​(int units)  
      • Methods inherited from class java.lang.Object

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

      • Margins

        public Margins​(float top,
                       float left,
                       float right,
                       float bottom)
    • Method Detail

      • getMargins

        public float[] getMargins​(int units)
        Get the margins as an array of 4 values in the order top, left, right, bottom. The values returned are in the given units.
        Parameters:
        units - Unit conversion factor, either INCH or MM.
        Returns:
        margins as array of top, left, right, bottom in the specified units.
        Throws:
        java.lang.IllegalArgumentException - on invalid units.
      • getTop

        public float getTop​(int units)
      • getLeft

        public float getLeft​(int units)
      • getRight

        public float getRight​(int units)
      • getBottom

        public float getBottom​(int units)
      • getCategory

        public final java.lang.Class<? extends javax.print.attribute.Attribute> getCategory()
        Specified by:
        getCategory in interface javax.print.attribute.Attribute
      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface javax.print.attribute.Attribute
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        public java.lang.String toString​(int units)
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object