PdfTextFormat Class
Represents formatting properties that only affect PDF textual content.
- Inheritance:
- System.ObjectPdfTextFormat
Remarks
The PdfTextFormat is applicable to PdfTextContent and PdfFormContent, and is not applicable to any other PdfVisualContentElement.
If the PdfTextFormat is not applicable, then text-related graphics state parameters won't be written when writing the associated PdfVisualContentElement to the underlying content stream.
Properties
CharacterSpacing
Gets or sets the character spacing in unscaled text space units (although it shall be subject to scaling by the HorizontalScaling parameter if the writing mode is horizontal).
When the glyph for each character in the string is rendered, CharacterSpacing shall be added to the horizontal or vertical component of the glyph's displacement, depending on the writing mode.
Initial value: 0.
Property Value
- System.Double
The character spacing in unscaled text space units.
Exceptions
- System.ArgumentException
Value is either System.Double.NaN, System.Double.NegativeInfinity or System.Double.PositiveInfinity.
See Also
Font
Gets the font.
Initial value: null.
Property Value
The font.
Remarks
Note that the Size of the returned PdfFont for PdfTextContent is resolved from the actual font size (retrieved with GetFont(out Double) method) and the TextTransform.
See Also
HorizontalScaling
Gets or sets the horizontal scaling that adjusts the width of glyphs by stretching or compressing them in the horizontal direction.
Its value shall be specified as a percentage of the normal width of the glyphs, with 1.0 (100%) being the normal width. The HorizontalScaling shall apply to the horizontal coordinate in text space, independently of the writing mode. It shall affect both the glyph's shape and its horizontal displacement (that is, its displacement vector). If the writing mode is horizontal, it shall also effect the spacing parameters CharacterSpacing and WordSpacing.
Initial value: 1.0 (100%) (normal width).
Property Value
- System.Double
The horizontal scaling that adjusts the width of glyphs by stretching or compressing them in the horizontal direction.
Exceptions
- System.ArgumentException
Value is either System.Double.NaN, System.Double.NegativeInfinity or System.Double.PositiveInfinity.
See Also
IsClipped
Gets or sets a value indicating whether the current PDF textual content is part of the clipping area (the same as IsApplied property on PdfTextContent).
Initial value: false.
Property Value
- System.Boolean
true if the current PDF textual content is part of the clipping area; otherwise, false.
See Also
IsFilled
Gets or sets a value indicating whether the current PDF textual content is filled (the same as IsApplied property on PdfTextContent).
Initial value: true.
Property Value
- System.Boolean
true if the current PDF textual content is filled; otherwise, false.
See Also
IsStroked
Gets or sets a value indicating whether the current PDF textual content is stroked (the same as IsApplied property on PdfTextContent).
Initial value: false.
Property Value
- System.Boolean
true if the current PDF textual content is stroked; otherwise, false.
See Also
Knockout
Gets or sets the text knockout parameter (PDF 1.4) that determines what PdfTextContent elements shall be considered elementary objects for purposes of color compositing in the transparent imaging model.
Initial value: true.
Property Value
- System.Boolean
If the value is false, each glyph in a PdfTextContent shall be treated as a separate elementary object; when glyphs overlap, they shall composite with one another. If the value is true, all glyphs in the PdfTextContent shall be treated together as a single elementary object; when glyphs overlap, later glyphs shall overwrite (“knock out”) earlier ones in the area of overlap.
See Also
Leading
Gets or sets the leading that specifies the vertical distance between the baselines of adjacent lines of text in unscaled text space units.
Initial value: 0.
Property Value
- System.Double
The leading that specifies the vertical distance between the baselines of adjacent lines of text in unscaled text space units.
Exceptions
- System.ArgumentException
Value is either System.Double.NaN, System.Double.NegativeInfinity or System.Double.PositiveInfinity.
See Also
Rise
Gets or sets the rise that shall specify the distance, in unscaled text space units, to move the baseline up or down from its default location. Positive values of Rise shall move the baseline up.
Initial value: 0.
Property Value
- System.Double
The rise that shall specify the distance, in unscaled text space units, to move the baseline up or down from its default location.
Exceptions
- System.ArgumentException
Value is either System.Double.NaN, System.Double.NegativeInfinity or System.Double.PositiveInfinity.
See Also
WordSpacing
Gets or sets the word spacing that works the same way as CharacterSpacing but shall apply only to the ASCII SPACE character (20h).
Initial value: 0.
Property Value
- System.Double
The word spacing.
Exceptions
- System.ArgumentException
Value is either System.Double.NaN, System.Double.NegativeInfinity or System.Double.PositiveInfinity.
See Also
Methods
GetFont(out Double)
Gets the font and size.
public PdfBasicFont GetFont(out double size)
Public Function GetFont(ByRef size As Double) As PdfBasicFont
Parameters
size
- System.Double
The size.
Returns
The font.
See Also
SetFont(PdfBasicFont, Double)
Sets the font and size.
warning
Note that the font
might not contain all the necessary information to correctly position, render and/or convert to Unicode all characters of the EncodedText so set it at your own risk.
public void SetFont(PdfBasicFont font, double size)
Public Sub SetFont(font As PdfBasicFont, size As Double)
Parameters
font
- PdfBasicFont
The font.
size
- System.Double
The size.
Exceptions
- System.ArgumentNullException
The font
is null.
- System.ArgumentException
The size
is either System.Double.NaN, System.Double.NegativeInfinity or System.Double.PositiveInfinity.