com.lowagie.text.rtf.document

Class RtfDocumentSettings

public class RtfDocumentSettings extends Object

The RtfDocumentSettings contains output specific settings. These settings modify how the actual document is then generated and some settings may mean that some RTF readers can't read the document or render it wrongly.

Version: $Id: RtfDocumentSettings.java 2776 2007-05-23 20:01:40Z hallm $

Author: Mark Hall (mhall@edu.uni-klu.ac.at) Thomas Bickel (tmb99@inode.at)

Field Summary
booleanalwaysGenerateSoftLinebreaks
Whether to always generate soft linebreaks for \n in Chunks.
booleanalwaysUseUnicode
Whether to always translate characters past 'z' into unicode representations.
intdataCacheStyle
How to cache the document during generation.
RtfDocumentdocument
The RtfDocument this RtfDocumentSettings belongs to.
booleanimagePDFConformance
Whether images should be written in order to mimick the PDF output.
booleanoutputDebugLineBreaks
Whether to output the line breaks that make the rtf document source more readable.
booleanoutputTableRowDefinitionAfter
Whether to also output the table row definition after the cell content.
booleanwriteImageScalingInformation
Whether to write image scaling information.
Constructor Summary
RtfDocumentSettings(RtfDocument document)
Constructs a new RtfDocumentSettings object.
Method Summary
intgetDataCacheStyle()
Gets the current data cache style.
booleanisAlwaysGenerateSoftLinebreaks()
Gets whether all linebreaks inside Chunks are generated as soft linebreaks.
booleanisAlwaysUseUnicode()
Gets whether all characters bigger than 'z' are represented as unicode.
booleanisImagePDFConformance()
Gets the current setting on image PDF conformance.
booleanisOutputDebugLineBreaks()
Gets whether to output the line breaks for increased rtf document readability.
booleanisOutputTableRowDefinitionAfter()
Gets whether the table row definition should also be written after the cell content.
booleanisWriteImageScalingInformation()
Gets whether to write scaling information for images.
voidregisterParagraphStyle(RtfParagraphStyle rtfParagraphStyle)
Registers the RtfParagraphStyle for further use in the document.
voidsetAlwaysGenerateSoftLinebreaks(boolean alwaysGenerateSoftLinebreaks)
Sets whether to always generate soft linebreaks.
voidsetAlwaysUseUnicode(boolean alwaysUseUnicode)
Sets whether to represent all characters bigger than 'z' as unicode.
voidsetDataCacheStyle(int dataCacheStyle)
Sets the data cache style.
voidsetImagePDFConformance(boolean imagePDFConformance)
Sets the image PDF conformance setting.
voidsetOptionsForMSWord2000And97()
Set the options required for RTF documents to display correctly in MS Word 2000 and MS Word 97.
voidsetOptionsForMSWordForMac()
Set the options required for RTF documents to display correctly in MS Word for Mac.
voidsetOptionsForMSWordXP()
Set the options required for RTF documents to display correctly in MS Word XP (2002).
voidsetOptionsForOpenOfficeOrg()
Set the options required for RTF documents to display correctly in OpenOffice.Org Writer.
voidsetOutputDebugLineBreaks(boolean outputDebugLineBreaks)
Sets whether to output the line breaks for increased rtf document readability.
voidsetOutputTableRowDefinitionAfter(boolean outputTableRowDefinitionAfter)
Sets whether the table row definition should also be written after the cell content.
voidsetWriteImageScalingInformation(boolean writeImageScalingInformation)
Sets whether image scaling information should be written.

Field Detail

alwaysGenerateSoftLinebreaks

private boolean alwaysGenerateSoftLinebreaks
Whether to always generate soft linebreaks for \n in Chunks.

alwaysUseUnicode

private boolean alwaysUseUnicode
Whether to always translate characters past 'z' into unicode representations.

dataCacheStyle

private int dataCacheStyle
How to cache the document during generation. Defaults to RtfDataCache.CACHE_MEMORY;

document

private RtfDocument document
The RtfDocument this RtfDocumentSettings belongs to.

imagePDFConformance

private boolean imagePDFConformance
Whether images should be written in order to mimick the PDF output.

outputDebugLineBreaks

private boolean outputDebugLineBreaks
Whether to output the line breaks that make the rtf document source more readable.

outputTableRowDefinitionAfter

private boolean outputTableRowDefinitionAfter
Whether to also output the table row definition after the cell content.

writeImageScalingInformation

private boolean writeImageScalingInformation
Whether to write image scaling information. This is required for Word 2000, 97 and Word for Mac

Constructor Detail

RtfDocumentSettings

public RtfDocumentSettings(RtfDocument document)
Constructs a new RtfDocumentSettings object.

Parameters: document The RtfDocument this RtfDocumentSettings belong to.

Method Detail

getDataCacheStyle

public int getDataCacheStyle()
Gets the current data cache style.

Returns: The current data cache style.

isAlwaysGenerateSoftLinebreaks

public boolean isAlwaysGenerateSoftLinebreaks()
Gets whether all linebreaks inside Chunks are generated as soft linebreaks.

Returns: True if soft linebreaks are generated, false for hard linebreaks.

isAlwaysUseUnicode

public boolean isAlwaysUseUnicode()
Gets whether all characters bigger than 'z' are represented as unicode.

Returns: True if unicode representation is used, false otherwise.

isImagePDFConformance

public boolean isImagePDFConformance()
Gets the current setting on image PDF conformance.

Returns: The current image PDF conformance.

isOutputDebugLineBreaks

public boolean isOutputDebugLineBreaks()
Gets whether to output the line breaks for increased rtf document readability.

Returns: Whether to output line breaks.

isOutputTableRowDefinitionAfter

public boolean isOutputTableRowDefinitionAfter()
Gets whether the table row definition should also be written after the cell content.

Returns: Returns the outputTableRowDefinitionAfter.

isWriteImageScalingInformation

public boolean isWriteImageScalingInformation()
Gets whether to write scaling information for images.

Returns: Whether to write scaling information for images.

registerParagraphStyle

public void registerParagraphStyle(RtfParagraphStyle rtfParagraphStyle)
Registers the RtfParagraphStyle for further use in the document. This does not need to be done for the default styles in the RtfParagraphStyle object. Those are added automatically.

Parameters: rtfParagraphStyle The RtfParagraphStyle to register.

setAlwaysGenerateSoftLinebreaks

public void setAlwaysGenerateSoftLinebreaks(boolean alwaysGenerateSoftLinebreaks)
Sets whether to always generate soft linebreaks.

Parameters: alwaysGenerateSoftLinebreaks Whether to always generate soft linebreaks.

setAlwaysUseUnicode

public void setAlwaysUseUnicode(boolean alwaysUseUnicode)
Sets whether to represent all characters bigger than 'z' as unicode.

Parameters: alwaysUseUnicode True to use unicode representation, false otherwise.

setDataCacheStyle

public void setDataCacheStyle(int dataCacheStyle)
Sets the data cache style. This controls where the document is cached during generation. Two cache styles are supported:

Parameters: dataCacheStyle The data cache style to set. Valid constants can be found in RtfDataCache.

See Also: RtfDataCache

setImagePDFConformance

public void setImagePDFConformance(boolean imagePDFConformance)
Sets the image PDF conformance setting. By default images will be added as if they were displayed with 72dpi. Set this to false if images should be generated with the Word default DPI setting.

Parameters: imagePDFConformance True if PDF equivalence is desired, false for the default Word display.

setOptionsForMSWord2000And97

public void setOptionsForMSWord2000And97()
Set the options required for RTF documents to display correctly in MS Word 2000 and MS Word 97. Sets outputTableRowDefinitionAfter = true and writeImageScalingInformation = true.

setOptionsForMSWordForMac

public void setOptionsForMSWordForMac()
Set the options required for RTF documents to display correctly in MS Word for Mac. Sets writeImageScalingInformation = true.

setOptionsForMSWordXP

public void setOptionsForMSWordXP()
Set the options required for RTF documents to display correctly in MS Word XP (2002). Sets writeImageScalingInformation = false.

setOptionsForOpenOfficeOrg

public void setOptionsForOpenOfficeOrg()
Set the options required for RTF documents to display correctly in OpenOffice.Org Writer. Sets outputTableRowDefinitionAfter = false.

setOutputDebugLineBreaks

public void setOutputDebugLineBreaks(boolean outputDebugLineBreaks)
Sets whether to output the line breaks for increased rtf document readability. Some line breaks may be added where the rtf specification demands it.

Parameters: outputDebugLineBreaks The outputDebugLineBreaks to set.

setOutputTableRowDefinitionAfter

public void setOutputTableRowDefinitionAfter(boolean outputTableRowDefinitionAfter)
Sets whether the table row definition should also be written after the cell content. This is recommended to be set to true if you need Word2000 compatiblity and false if the document should be opened in OpenOffice.org Writer.

Parameters: outputTableRowDefinitionAfter The outputTableRowDefinitionAfter to set.

setWriteImageScalingInformation

public void setWriteImageScalingInformation(boolean writeImageScalingInformation)
Sets whether image scaling information should be written. This needs to be set to true MS Word 2000, MS Word 97 and Word for Mac.

Parameters: writeImageScalingInformation Whether to write image scaling information.