Class PageBoundaries
- java.lang.Object
-
- org.apache.fop.render.extensions.prepress.PageBoundaries
-
public class PageBoundaries extends java.lang.Object
This class is used to calculate the effective boundaries of a page including special-purpose boxes used in prepress. These are specified using extension attributes: bleedBox, trimBox and cropBox. The semantics are further described on the website.
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Rectangle
bleedBox
private java.awt.Rectangle
cropBox
static org.apache.xmlgraphics.util.QName
EXT_BLEED
The extension attribute for calculating the PDF BleedBox area - specifies the bleed width.static org.apache.xmlgraphics.util.QName
EXT_CROP_BOX
The extension attribute for the PDF CropBox area.static org.apache.xmlgraphics.util.QName
EXT_CROP_OFFSET
The extension attribute for the PDF CropBox area.private java.awt.Rectangle
mediaBox
private static java.util.regex.Pattern
SIZE_UNIT_PATTERN
private java.awt.Rectangle
trimBox
private static java.util.regex.Pattern
WHITESPACE_PATTERN
-
Constructor Summary
Constructors Constructor Description PageBoundaries(java.awt.Dimension pageSize, java.lang.String bleed, java.lang.String cropOffset, java.lang.String cropBoxSelector)
Creates a new instance.PageBoundaries(java.awt.Dimension pageSize, java.util.Map foreignAttributes)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
calculate(java.awt.Dimension pageSize, java.lang.String bleed, java.lang.String cropOffset, java.lang.String cropBoxSelector)
java.awt.Rectangle
getBleedBox()
Returns the bleed box for the page.private static java.awt.Rectangle
getBleedBoxRectangle(java.awt.Rectangle trimBox, java.lang.String bleed)
The BleedBox is calculated by expanding the TrimBox by the bleed widths.java.awt.Rectangle
getCropBox()
Returns the crop box for the page.private static java.awt.Rectangle
getCropMarksAreaRectangle(java.awt.Rectangle trimBox, java.lang.String cropOffsets)
The MediaBox is calculated by expanding the TrimBox by the crop offsets.private static int
getLengthIntValue(java.lang.String length)
java.awt.Rectangle
getMediaBox()
Returns the media box for the page.private static java.awt.Rectangle
getRectangleUsingOffset(java.awt.Rectangle originalRect, java.lang.String offset)
java.awt.Rectangle
getTrimBox()
Returns the trim box for the page.
-
-
-
Field Detail
-
EXT_BLEED
public static final org.apache.xmlgraphics.util.QName EXT_BLEED
The extension attribute for calculating the PDF BleedBox area - specifies the bleed width.
-
EXT_CROP_OFFSET
public static final org.apache.xmlgraphics.util.QName EXT_CROP_OFFSET
The extension attribute for the PDF CropBox area.
-
EXT_CROP_BOX
public static final org.apache.xmlgraphics.util.QName EXT_CROP_BOX
The extension attribute for the PDF CropBox area.
-
SIZE_UNIT_PATTERN
private static final java.util.regex.Pattern SIZE_UNIT_PATTERN
-
WHITESPACE_PATTERN
private static final java.util.regex.Pattern WHITESPACE_PATTERN
-
trimBox
private java.awt.Rectangle trimBox
-
bleedBox
private java.awt.Rectangle bleedBox
-
mediaBox
private java.awt.Rectangle mediaBox
-
cropBox
private java.awt.Rectangle cropBox
-
-
Constructor Detail
-
PageBoundaries
public PageBoundaries(java.awt.Dimension pageSize, java.lang.String bleed, java.lang.String cropOffset, java.lang.String cropBoxSelector)
Creates a new instance.- Parameters:
pageSize
- the page size (in mpt) defined by the simple-page-master.bleed
- the bleed value (raw value as given in the property value)cropOffset
- the crop-offset value (raw value as given in the property value)cropBoxSelector
- the crop-box, valid values: (trim-box|bleed-box|media-box)
-
PageBoundaries
public PageBoundaries(java.awt.Dimension pageSize, java.util.Map foreignAttributes)
Creates a new instance.- Parameters:
pageSize
- the page size (in mpt) defined by the simple-page-master.foreignAttributes
- the foreign attributes for the page (used to extract the extension attribute values)
-
-
Method Detail
-
calculate
private void calculate(java.awt.Dimension pageSize, java.lang.String bleed, java.lang.String cropOffset, java.lang.String cropBoxSelector)
-
getTrimBox
public java.awt.Rectangle getTrimBox()
Returns the trim box for the page. This is equal to the page size given in XSL-FO. After production the printed media is trimmed to this rectangle.- Returns:
- the trim box
-
getBleedBox
public java.awt.Rectangle getBleedBox()
Returns the bleed box for the page.- Returns:
- the bleed box
-
getMediaBox
public java.awt.Rectangle getMediaBox()
Returns the media box for the page.- Returns:
- the media box
-
getCropBox
public java.awt.Rectangle getCropBox()
Returns the crop box for the page. The crop box is used by Adobe Acrobat to select which parts of the document shall be displayed and it also defines the rectangle to which a RIP will clip the document. For bitmap output, this defines the size of the bitmap.- Returns:
- the crop box
-
getBleedBoxRectangle
private static java.awt.Rectangle getBleedBoxRectangle(java.awt.Rectangle trimBox, java.lang.String bleed)
The BleedBox is calculated by expanding the TrimBox by the bleed widths.- Parameters:
trimBox
- the TrimBox rectanglebleed
- the given bleed widths- Returns:
- the calculated BleedBox rectangle
-
getCropMarksAreaRectangle
private static java.awt.Rectangle getCropMarksAreaRectangle(java.awt.Rectangle trimBox, java.lang.String cropOffsets)
The MediaBox is calculated by expanding the TrimBox by the crop offsets.- Parameters:
trimBox
- the TrimBox rectanglecropOffsets
- the given crop offsets- Returns:
- the calculated MediaBox rectangle
-
getRectangleUsingOffset
private static java.awt.Rectangle getRectangleUsingOffset(java.awt.Rectangle originalRect, java.lang.String offset)
-
getLengthIntValue
private static int getLengthIntValue(java.lang.String length)
-
-