Package com.lowagie.text.rtf.document
Class RtfPageSetting
- java.lang.Object
-
- com.lowagie.text.rtf.RtfElement
-
- com.lowagie.text.rtf.document.RtfPageSetting
-
- All Implemented Interfaces:
RtfBasicElement
,RtfExtendedElement
,com.lowagie.text.RtfElementInterface
public class RtfPageSetting extends RtfElement implements RtfExtendedElement
The RtfPageSetting stores the page size / page margins for a RtfDocument. INTERNAL CLASS - NOT TO BE USED DIRECTLY- Version:
- $Id:RtfPageSetting.java 3126 2008-02-07 20:30:46Z hallm $
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
landscape
Whether the page is portrait or landscapeprivate static byte[]
LANDSCAPE
Constant for landscapeprivate static byte[]
MARGIN_BOTTOM
Constant for the bottom marginprivate static byte[]
MARGIN_LEFT
Constant for the left marginprivate static byte[]
MARGIN_RIGHT
Constant for the right marginprivate static byte[]
MARGIN_TOP
Constant for the top marginprivate int
marginBottom
The bottom margin to useprivate int
marginLeft
The left margin to useprivate int
marginRight
The right margin to useprivate int
marginTop
The top margin to useprivate static byte[]
PAGE_HEIGHT
Constant for the page widthprivate static byte[]
PAGE_WIDTH
Constant for the page heightprivate int
pageHeight
The page height to useprivate int
pageWidth
The page width to useprivate static byte[]
SECTION_MARGIN_BOTTOM
Constant for the section bottom marginprivate static byte[]
SECTION_MARGIN_LEFT
Constant for the section left marginprivate static byte[]
SECTION_MARGIN_RIGHT
Constant for the section right marginprivate static byte[]
SECTION_MARGIN_TOP
Constant for the section top marginprivate static byte[]
SECTION_PAGE_HEIGHT
Constant for the section page heightprivate static byte[]
SECTION_PAGE_WIDTH
Constant for the section page width-
Fields inherited from class com.lowagie.text.rtf.RtfElement
document, inHeader, inTable
-
Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR
-
-
Constructor Summary
Constructors Constructor Description RtfPageSetting(RtfDocument doc)
Constructs a new RtfPageSetting object belonging to a RtfDocument.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMarginBottom()
Gets the bottom marginint
getMarginLeft()
Gets the left marginint
getMarginRight()
Gets the right marginint
getMarginTop()
Gets the top marginint
getPageHeight()
Gets the page heightint
getPageWidth()
Gets the page widthprivate boolean
guessFormat(com.lowagie.text.Rectangle pageSize, boolean rotate)
This method tries to fit theRectangle pageSize
to one of the predefined PageSize rectangles.private boolean
rectEquals(com.lowagie.text.Rectangle rect1, com.lowagie.text.Rectangle rect2)
This method compares to Rectangles.void
setMarginBottom(int marginBottom)
Sets the bottom marginvoid
setMarginLeft(int marginLeft)
Sets the left margin to usevoid
setMarginRight(int marginRight)
Sets the right margin to usevoid
setMarginTop(int marginTop)
Sets the top margin to usevoid
setPageHeight(int pageHeight)
Sets the page height to usevoid
setPageSize(com.lowagie.text.Rectangle pageSize)
Set the page size to use.void
setPageWidth(int pageWidth)
Sets the page width to usevoid
writeContent(java.io.OutputStream out)
unusedvoid
writeDefinition(java.io.OutputStream result)
Writes the page size / page margin definitionvoid
writeSectionDefinition(java.io.OutputStream result)
Writes the definition part for a new section-
Methods inherited from class com.lowagie.text.rtf.RtfElement
intToByteArray, isInTable, setInHeader, setInTable, setRtfDocument
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.lowagie.text.rtf.RtfBasicElement
setInHeader, setInTable, setRtfDocument
-
-
-
-
Field Detail
-
PAGE_WIDTH
private static final byte[] PAGE_WIDTH
Constant for the page height
-
PAGE_HEIGHT
private static final byte[] PAGE_HEIGHT
Constant for the page width
-
MARGIN_LEFT
private static final byte[] MARGIN_LEFT
Constant for the left margin
-
MARGIN_RIGHT
private static final byte[] MARGIN_RIGHT
Constant for the right margin
-
MARGIN_TOP
private static final byte[] MARGIN_TOP
Constant for the top margin
-
MARGIN_BOTTOM
private static final byte[] MARGIN_BOTTOM
Constant for the bottom margin
-
LANDSCAPE
private static final byte[] LANDSCAPE
Constant for landscape
-
SECTION_PAGE_WIDTH
private static final byte[] SECTION_PAGE_WIDTH
Constant for the section page width
-
SECTION_PAGE_HEIGHT
private static final byte[] SECTION_PAGE_HEIGHT
Constant for the section page height
-
SECTION_MARGIN_LEFT
private static final byte[] SECTION_MARGIN_LEFT
Constant for the section left margin
-
SECTION_MARGIN_RIGHT
private static final byte[] SECTION_MARGIN_RIGHT
Constant for the section right margin
-
SECTION_MARGIN_TOP
private static final byte[] SECTION_MARGIN_TOP
Constant for the section top margin
-
SECTION_MARGIN_BOTTOM
private static final byte[] SECTION_MARGIN_BOTTOM
Constant for the section bottom margin
-
pageWidth
private int pageWidth
The page width to use
-
pageHeight
private int pageHeight
The page height to use
-
marginLeft
private int marginLeft
The left margin to use
-
marginRight
private int marginRight
The right margin to use
-
marginTop
private int marginTop
The top margin to use
-
marginBottom
private int marginBottom
The bottom margin to use
-
landscape
private boolean landscape
Whether the page is portrait or landscape
-
-
Constructor Detail
-
RtfPageSetting
public RtfPageSetting(RtfDocument doc)
Constructs a new RtfPageSetting object belonging to a RtfDocument.- Parameters:
doc
- The RtfDocument this RtfPageSetting belongs to
-
-
Method Detail
-
writeContent
public void writeContent(java.io.OutputStream out) throws java.io.IOException
unused- Specified by:
writeContent
in interfaceRtfBasicElement
- Specified by:
writeContent
in classRtfElement
- Parameters:
out
- TheOutputStream
to write the content to- Throws:
java.io.IOException
-
writeDefinition
public void writeDefinition(java.io.OutputStream result) throws java.io.IOException
Writes the page size / page margin definition- Specified by:
writeDefinition
in interfaceRtfExtendedElement
- Parameters:
result
- TheOutputStream
to write the element definition to- Throws:
java.io.IOException
-
writeSectionDefinition
public void writeSectionDefinition(java.io.OutputStream result) throws java.io.IOException
Writes the definition part for a new section- Throws:
java.io.IOException
-
getMarginBottom
public int getMarginBottom()
Gets the bottom margin- Returns:
- Returns the bottom margin
-
setMarginBottom
public void setMarginBottom(int marginBottom)
Sets the bottom margin- Parameters:
marginBottom
- The bottom margin to use
-
getMarginLeft
public int getMarginLeft()
Gets the left margin- Returns:
- Returns the left margin
-
setMarginLeft
public void setMarginLeft(int marginLeft)
Sets the left margin to use- Parameters:
marginLeft
- The left margin to use
-
getMarginRight
public int getMarginRight()
Gets the right margin- Returns:
- Returns the right margin
-
setMarginRight
public void setMarginRight(int marginRight)
Sets the right margin to use- Parameters:
marginRight
- The right margin to use
-
getMarginTop
public int getMarginTop()
Gets the top margin- Returns:
- Returns the top margin
-
setMarginTop
public void setMarginTop(int marginTop)
Sets the top margin to use- Parameters:
marginTop
- The top margin to use
-
getPageHeight
public int getPageHeight()
Gets the page height- Returns:
- Returns the page height
-
setPageHeight
public void setPageHeight(int pageHeight)
Sets the page height to use- Parameters:
pageHeight
- The page height to use
-
getPageWidth
public int getPageWidth()
Gets the page width- Returns:
- Returns the page width
-
setPageWidth
public void setPageWidth(int pageWidth)
Sets the page width to use- Parameters:
pageWidth
- The page width to use
-
setPageSize
public void setPageSize(com.lowagie.text.Rectangle pageSize)
Set the page size to use. This method will use guessFormat to try to guess the correct page format. If no format could be guessed, the sizes from the pageSize are used and the landscape setting is determined by comparing width and height;- Parameters:
pageSize
- The pageSize to use
-
guessFormat
private boolean guessFormat(com.lowagie.text.Rectangle pageSize, boolean rotate)
This method tries to fit theRectangle pageSize
to one of the predefined PageSize rectangles. If a match is found the pageWidth and pageHeight will be set according to values determined from files generated by MS Word2000 and OpenOffice 641. If no match is found the method will try to match the rotated Rectangle by calling itself with the parameter rotate set to true.- Parameters:
pageSize
- the page size for which to guess the correct formatrotate
- Whether we should try to rotate the size befor guessing the format- Returns:
True
if the format was guessed,false/
otherwise
-
rectEquals
private boolean rectEquals(com.lowagie.text.Rectangle rect1, com.lowagie.text.Rectangle rect2)
This method compares to Rectangles. They are considered equal if width and height are the same- Parameters:
rect1
- The first Rectangle to comparerect2
- The second Rectangle to compare- Returns:
True
if the Rectangles equal,false
otherwise
-
-