Package com.pd4ml
Class PageMargins
- java.lang.Object
-
- com.pd4ml.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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.pd4ml.Dimensions
Dimensions.Units
-
-
Field Summary
Fields Modifier and Type Field Description floatbottomThe bottom margin in points.static PageMarginsDEFAULT_PAGE_MARGINSThe default margins for PDF, RTF and DOCX output: 10 mm on each side.floatleftThe left margin in points.floatrightThe right margin in points.floattopThe top margin in points.-
Fields inherited from interface com.pd4ml.Dimensions
MM_PER_INCH, PIXELS_PER_POINT, POINTS_PER_INCH, POINTS_PER_MM
-
-
Constructor Summary
Constructors Constructor Description PageMargins(float left, float top, float right, float bottom)Creates page margins in points (1/72 inch).PageMargins(float left, float top, float right, float bottom, Dimensions.Units units)Creates page margins in the given units.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PageMarginsflipHorizontal()Returns a copy with the left and right margins swapped, for example for the facing pages of a book.PageMarginsflipVertical()Returns a copy with the top and bottom margins swapped.PageMarginsrotate()Returns a copy rotated by 90 degrees, matching a page rotated withPageSize.rotate(): the new left margin is the old top margin, the new top is the old right, and so on.java.lang.StringtoString()
-
-
-
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 pointstop- the top margin in pointsright- the right margin in pointsbottom- 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 margintop- the top marginright- the right marginbottom- the bottom marginunits- 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:
toStringin classjava.lang.Object
-
rotate
public PageMargins rotate()
Returns a copy rotated by 90 degrees, matching a page rotated withPageSize.rotate(): the new left margin is the old top margin, the new top is the old right, and so on.- Returns:
- the rotated margins
-
-