Package org.apache.fop.render.pcl
Class PCLPageDefinition
java.lang.Object
org.apache.fop.render.pcl.PCLPageDefinition
This class represents a page format with PCL-specific properties.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static PCLPageDefinition
private final boolean
private final Rectangle
private final String
private static List
private final Dimension
private final int
-
Constructor Summary
ConstructorsConstructorDescriptionPCLPageDefinition
(String name, int selector, Dimension physicalPageSize, Rectangle logicalPageRect, boolean landscape) Main constructor -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
convert300dpiDotsToMpt
(int offset) Converts an offset values for logical pages to millipoints.private static Rectangle
createLogicalPageRect
(int x, int y, int width, int height) private static void
private static Dimension
createPhysicalPageSizeInch
(float width, float height) private static Dimension
createPhysicalPageSizeMm
(float width, float height) static PCLPageDefinition
getName()
static PCLPageDefinition
getPageDefinition
(long width, long height, int errorMargin) Tries to determine a matching page definition.static PCLPageDefinition
getPageDefinition
(String name) Returns a page definition based on a page format.int
boolean
private boolean
matches
(long width, long height, int errorMargin) toString()
-
Field Details
-
pageDefinitions
-
defaultPageDefinition
-
name
-
selector
private final int selector -
physicalPageSize
-
logicalPageRect
-
landscape
private final boolean landscape
-
-
Constructor Details
-
PCLPageDefinition
public PCLPageDefinition(String name, int selector, Dimension physicalPageSize, Rectangle logicalPageRect, boolean landscape) Main constructor- Parameters:
name
- the name of the page definitionselector
- the selector used by the <ESC> command (page size)physicalPageSize
- the physical page sizelogicalPageRect
- the rectangle defining the logical pagelandscape
- true if it is a landscape format
-
-
Method Details
-
getName
- Returns:
- the name of the page definition
-
getSelector
public int getSelector()- Returns:
- the selector used by the <ESC> command (page size)
-
isLandscapeFormat
public boolean isLandscapeFormat()- Returns:
- true if it is a landscape format
-
getPhysicalPageSize
- Returns:
- the physical page size
-
getLogicalPageRect
- Returns:
- the rectangle defining the logical page
-
matches
private boolean matches(long width, long height, int errorMargin) -
toString
-
getPageDefinition
Tries to determine a matching page definition.- Parameters:
width
- the physical page width (in mpt)height
- the physical page height (in mpt)errorMargin
- the error margin for detecting the right page definition- Returns:
- the page definition or null if no match was found
-
getPageDefinition
Returns a page definition based on a page format.- Parameters:
name
- the name of the page format (ex. "A4" or "Letter")- Returns:
- the page definition or null if no match was found
-
getDefaultPageDefinition
- Returns:
- the default page definition (letter)
-
convert300dpiDotsToMpt
private static int convert300dpiDotsToMpt(int offset) Converts an offset values for logical pages to millipoints. The values are given as pixels in a 300dpi environment.- Parameters:
offset
- the offset as given in the PCL 5 specification (under "Printable Area")- Returns:
- the converted value in millipoints
-
createPhysicalPageSizeInch
-
createPhysicalPageSizeMm
-
createLogicalPageRect
-
createPageDefinitions
private static void createPageDefinitions()
-