Table of Contents

Class RtfDocumentSettings

Namespace
iTextSharp.text.rtf.document
Assembly
iTextSharp.LGPLv2.Core.dll

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. @author Mark Hall (Mark.Hall@mail.room3b.eu) @author Thomas Bickel (tmb99@inode.at)

public class RtfDocumentSettings
Inheritance
RtfDocumentSettings
Inherited Members

Constructors

RtfDocumentSettings(RtfDocument)

Constructs a new RtfDocumentSettings object.

public RtfDocumentSettings(RtfDocument document)

Parameters

document RtfDocument

The RtfDocument this RtfDocumentSettings belong to.

Methods

GetDataCacheStyle()

Gets the current data cache style.

public int GetDataCacheStyle()

Returns

int

The current data cache style.

GetProtectionHashBytes()

Obtain the password has as a byte array. @since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public byte[] GetProtectionHashBytes()

Returns

byte[]

The bytes of the password hash as a byte array (byte[])

GetProtectionLevel()

@since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public int GetProtectionLevel()

Returns

int

RTF document protection level

GetProtectionLevelBytes()

@since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public byte[] GetProtectionLevelBytes()

Returns

byte[]

RTF document protection level as a byte array (byte[])

GetProtectionLevelRaw()

@since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public int GetProtectionLevelRaw()

Returns

int

RTF document protection level

GetReadOnlyRecommended()

Get the RTF flag that recommends if the the document should be opened in read only mode. @since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public bool GetReadOnlyRecommended()

Returns

bool

true if flag is set, false if it is not set

IsAlwaysGenerateSoftLinebreaks()

Gets whether all linebreaks inside Chunks are generated as soft linebreaks.

public bool IsAlwaysGenerateSoftLinebreaks()

Returns

bool

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

IsAlwaysUseUnicode()

Gets whether all characters bigger than 'z' are represented as unicode.

public bool IsAlwaysUseUnicode()

Returns

bool

True if unicode representation is used, false otherwise.

IsDocumentProtected()

Determine if document has protection enabled. @since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public bool IsDocumentProtected()

Returns

bool

true if protection is enabled, false if it is not enabled

IsImagePdfConformance()

Gets the current setting on image PDF conformance.

public bool IsImagePdfConformance()

Returns

bool

The current image PDF conformance.

IsImageWrittenAsBinary()

Gets whether images are written as binary data or are hex encoded. Defaults to true . @since 2.1.1 @author Mark Hall (Mark.Hall@mail.room3b.eu)

public bool IsImageWrittenAsBinary()

Returns

bool

True if images are written as binary data, false if hex encoded.

IsOutputDebugLineBreaks()

Gets whether to output the line breaks for increased rtf document readability.

public bool IsOutputDebugLineBreaks()

Returns

bool

Whether to output line breaks.

IsOutputTableRowDefinitionAfter()

Gets whether the table row definition should also be written after the cell content.

public bool IsOutputTableRowDefinitionAfter()

Returns

bool

Returns the outputTableRowDefinitionAfter.

IsWriteImageScalingInformation()

Gets whether to write scaling information for images.

public bool IsWriteImageScalingInformation()

Returns

bool

Whether to write scaling information for images.

RegisterParagraphStyle(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.

public void RegisterParagraphStyle(RtfParagraphStyle rtfParagraphStyle)

Parameters

rtfParagraphStyle RtfParagraphStyle

The RtfParagraphStyle to register.

SetAlwaysGenerateSoftLinebreaks(bool)

Sets whether to always generate soft linebreaks.

public void SetAlwaysGenerateSoftLinebreaks(bool alwaysGenerateSoftLinebreaks)

Parameters

alwaysGenerateSoftLinebreaks bool

Whether to always generate soft linebreaks.

SetAlwaysUseUnicode(bool)

Sets whether to represent all characters bigger than 'z' as unicode.

public void SetAlwaysUseUnicode(bool alwaysUseUnicode)

Parameters

alwaysUseUnicode bool

True to use unicode representation, false otherwise.

SetDataCacheStyle(int)

Sets the data cache style. This controls where the document is cached during generation. Two cache styles are supported: RtfDataCache.CACHE_MEMORY: The document is cached in memory. This is fast, but places a limit on how big the document can get before causing OutOfMemoryExceptions. RtfDataCache.CACHE_DISK: The document is cached on disk. This is slower than the CACHE_MEMORY setting, but the document size is now only constrained by the amount of free disk space. in RtfDataCache. @see com.lowagie.text.rtf.document.output.output.RtfDataCache.

public void SetDataCacheStyle(int dataCacheStyle)

Parameters

dataCacheStyle int

The data cache style to set. Valid constants can be found

SetImagePdfConformance(bool)

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. for the default Word display.

public void SetImagePdfConformance(bool imagePdfConformance)

Parameters

imagePdfConformance bool

True if PDF equivalence is desired, false

SetImageWrittenAsBinary(bool)

Set whether images are written as binary data or are hex encoded. @since 2.1.1 @author Mark Hall (Mark.Hall@mail.room3b.eu)

public void SetImageWrittenAsBinary(bool imageWrittenAsBinary)

Parameters

imageWrittenAsBinary bool

True to write images as binary data, false for hex encoding.

SetNewPassword(string, string)

@since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public bool SetNewPassword(string oldPwd, string newPwd)

Parameters

oldPwd string

Old password - clear text

newPwd string

New password - clear text

Returns

bool

true if password set, false if password not set

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 .

public void SetOptionsForMsWord2000And97()

SetOptionsForMsWordForMac()

Set the options required for RTF documents to display correctly in MS Word for Mac. Sets writeImageScalingInformation = true .

public void SetOptionsForMsWordForMac()

SetOptionsForMsWordXp()

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

public void SetOptionsForMsWordXp()

SetOptionsForOpenOfficeOrg()

Set the options required for RTF documents to display correctly in OpenOffice.Org Writer. Sets outputTableRowDefinitionAfter = false .

public void SetOptionsForOpenOfficeOrg()

SetOutputDebugLineBreaks(bool)

Sets whether to output the line breaks for increased rtf document readability. Some line breaks may be added where the rtf specification demands it.

public void SetOutputDebugLineBreaks(bool outputDebugLineBreaks)

Parameters

outputDebugLineBreaks bool

The outputDebugLineBreaks to set.

SetOutputTableRowDefinitionAfter(bool)

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.

public void SetOutputTableRowDefinitionAfter(bool outputTableRowDefinitionAfter)

Parameters

outputTableRowDefinitionAfter bool

The outputTableRowDefinitionAfter to set.

SetPasswordHash(string)

This function is not intended for general use. Please see 'public bool SetProtection(int level, String pwd)' @since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public void SetPasswordHash(string pwd)

Parameters

pwd string

Password HASH to set the document password hash to.

SetProtection(int, string)

@since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public bool SetProtection(int level, string pwd)

Parameters

level int

Document protecton level

pwd string

Document password - clear text

Returns

bool

SetProtectionLevel(int)

@since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public bool SetProtectionLevel(int level)

Parameters

level int

Document protection level

Returns

bool

SetReadOnlyRecommended(bool)

Set the RTF flag that recommends the document be opened in read only mode. @since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public void SetReadOnlyRecommended(bool value)

Parameters

value bool

true if the flag is to be set, false if it is NOT to be set

SetWriteImageScalingInformation(bool)

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.

public void SetWriteImageScalingInformation(bool writeImageScalingInformation)

Parameters

writeImageScalingInformation bool

Whether to write image scaling information.

UnprotectDocument(string)

@since 2.1.1 @author Howard Shank (hgshank@yahoo.com)

public bool UnprotectDocument(string pwd)

Parameters

pwd string

Document password - clear text

Returns

bool

true if document unprotected, false if protection is not removed.