Package com.pd4ml

Class PageMargins

  • All Implemented Interfaces:
    Dimensions

    public class PageMargins
    extends java.lang.Object
    implements Dimensions
    Page margins: the distances between the page edges and the page content area, in points (1/72 inch). Page headers and footers are placed within the content area.
    
     pd4ml.setPageMargins(new PageMargins(20, 15, 20, 15, Dimensions.Units.MM));
     
    See Also:
    PD4ML.setPageMargins(PageMargins)
    • Field Detail

      • DEFAULT_PAGE_MARGINS

        public static final PageMargins DEFAULT_PAGE_MARGINS
        The default margins for PDF, RTF and DOCX output: 10 mm on each side.
      • left

        public float left
        The left margin in points.
      • top

        public float top
        The top margin in points.
      • right

        public float right
        The right margin in points.
      • bottom

        public float bottom
        The bottom margin in points.
    • Constructor Detail

      • PageMargins

        public PageMargins​(float left,
                           float top,
                           float right,
                           float bottom)
        Creates page margins in points (1/72 inch). Note the order of the arguments: left, top, right, bottom.
        Parameters:
        left - the left margin in points
        top - the top margin in points
        right - the right margin in points
        bottom - the bottom margin in points
      • PageMargins

        public PageMargins​(float left,
                           float top,
                           float right,
                           float bottom,
                           Dimensions.Units units)
        Creates page margins in the given units. The values are converted to points.
        Parameters:
        left - the left margin
        top - the top margin
        right - the right margin
        bottom - the bottom margin
        units - the units of the values: millimeters, points or pixels
    • Method Detail

      • flipHorizontal

        public PageMargins flipHorizontal()
        Returns a copy with the left and right margins swapped, for example for the facing pages of a book.
        Returns:
        the mirrored margins
      • flipVertical

        public PageMargins flipVertical()
        Returns a copy with the top and bottom margins swapped.
        Returns:
        the mirrored margins
      • toString

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

        public PageMargins rotate()
        Returns a copy rotated by 90 degrees, matching a page rotated with PageSize.rotate(): the new left margin is the old top margin, the new top is the old right, and so on.
        Returns:
        the rotated margins