Table of Contents

TTMSFNCPDFGraphicsLibOutputWriter Class

Low-level PDF content-stream writer used internally by the PDF graphics library to emit PDF operators, manage font state, and assemble stream segments into the final PDF document.

API unit family: TMSFNCPDFCoreLibBase

Syntax

TTMSFNCPDFGraphicsLibOutputWriter = class

Properties

Name Description
ContentStream Secondary content stream used for building page content before it is merged into Stream.
FontBase Base name prefix used when building PDF font resource dictionary keys.
FontCapHeight CapHeight value from the current font's metrics, used to build the PDF font descriptor.
FontCharArray Set of character code points referenced on the current page, used for font subsetting.
FontCharSpacing Additional character spacing in PDF text space units added between glyphs.
FontCharWidths Array of per-glyph advance widths for the current font, used to build the PDF Widths array.
FontColor Colour of the current font, applied as the PDF non-stroking colour before text operators.
FontEmbedding When True, the current font is embedded as a font subset in the PDF output.
FontGlyphRefName PDF resource reference name for the currently active glyph-mapped font, used for Unicode font embedding.
FontLeading Text leading (line spacing) in PDF text space units applied by the TL operator.
FontName PostScript name of the currently active font.
FontRefName PDF resource reference name for the currently active font, used in Tf operators.
FontSize Current font size in PDF user space units (points).
FontStyle Style flags of the current font (bold, italic, underline, strikethrough).
FontUnicode When True, text is written using Unicode encoding; when False, single-byte (Latin) encoding is used.
FontUnitsPerEm Units-per-em value from the current font's metrics, used to scale glyph widths.
FontUsedCharArray Flat list of all used character code points across the document, maintained by the subsetting engine.
FontWordSpacing Additional word spacing in PDF text space units added between words.
PageCountHint Pre-computed or estimated total page count used during stream finalisation to substitute page-count placeholders.
PageCountXPosInfos Ordered array of x-position placeholder registrations for deferred total-page-count substitution.
Stream Main PDF content stream for the current page or form XObject.
StreamPosition Current byte offset within the main content stream, used to patch cross-reference table entries.

Methods

Name Description
AddHex4 Formats a 16-bit word value as a four-digit uppercase hexadecimal string.
AddText Emits a PDF text-show operator (Tj or TJ) for AValue, using the current font encoding.
BeginText Emits the PDF BT (Begin Text) operator to open a text object in the content stream.
ClearProperties Resets all font state properties to their default values for reuse across pages.
CompressStream Compresses the content of AStream using zlib deflate and returns the result in a new TStringStream.
CompressString Compresses AValue using zlib deflate and returns the result in a new TStringStream.
ConvertColorToString Converts a graphics colour value to the PDF r g b decimal string representation.
ConvertFloatToString Converts a floating-point number to a compact decimal string suitable for PDF stream output.
ConvertStringToHex Converts a Unicode string to its hexadecimal byte representation for use in PDF hex strings.
CurveTo Emits a PDF c (cubic Bézier curve) operator using six control-point coordinates.
CurveTo2 Emits a PDF v (cubic Bézier curve, first control point implicit) operator using four coordinates.
EndText Emits the PDF ET (End Text) operator to close the current text object.
EscapeString Escapes special PDF characters in AValue so the string can be safely embedded in a PDF literal string.
FinishContentStream Finalises the current content stream and returns it as a stream, optionally applying zlib compression.
FontCharArrayAddValue Adds ACharValue to the font character array used for glyph subsetting if not already present.
FontCharArrayContainsValue Returns True when the current font character array already contains ACharValue.
GetFontCharWidth Returns the advance width of the character at APos in AText using the current font's width table.
IsUnicodeString Returns True when AValue contains at least one character with a code point above 127.
LineTo Emits a PDF l (line-to) path operator, appending a straight line to APoint.
MoveTextTo Emits a PDF Td operator to move the text position to APoint.
MoveTextToNextLine Emits a PDF T* operator to advance the text position to the start of the next line.
MoveTo Emits a PDF m (move-to) path operator, starting a new sub-path at APoint.
NotifyBitmap Fires OnNotifyBitmap to request an image resource reference from the document-level image cache.
NotifyGoTo Fires OnNotifyGoTo to record a named-destination internal link rectangle for the current page.
NotifyGoTo2 Fires OnNotifyGoTo2 to record a page-index internal link rectangle for the current page.
NotifyShading Fires OnNotifyShading to request a gradient shading resource reference from the document-level resource manager.
NotifyShadingRect Fires OnNotifyShadingRect to record the rectangle for the most recently added shading pattern.
NotifyText Fires OnNotifyText to pass a text segment to the document-level text extraction handler.
NotifyURL Fires OnNotifyURL to record a hyperlink annotation rectangle for the current page.
NotifyUnicode Fires OnNotifyUnicode to pass a Unicode text segment to the document-level ToUnicode CMap builder.
ReplaceString Replaces all occurrences of ASearchValue with AValue in the current content stream buffer.
ReplaceStrings Replaces multiple search strings with their corresponding replacement values in the current content stream buffer.
StartContentStream Begins a new content stream segment, optionally associated with a PDF indirect object.
StartNewStream Finalises the current content stream and begins a fresh one, optionally associating it with a PDF object.
Streams Returns the ordered list of content stream segments accumulated during the current page or object.
TextHeight Returns the line height of the current font in PDF user space units, computed from the font size and leading factor.
Write Appends raw bytes from a memory buffer to the current content stream.
WriteFillColor Emits a PDF non-stroking colour operator (rg or sc) for the given fill colour.
WriteFont Emits the current font name, size, and glyph reference as a PDF font selection operator (Tf).
WriteFontColor Emits the current font colour as a PDF non-stroking colour operator.
WriteFontLeading Emits the current font leading value as a PDF text leading operator (TL).
WriteMatrix Emits a PDF transformation matrix from a position and size, scaling the coordinate system to the given rectangle.
WriteRectangle Emits a PDF rectangle path operator (re) for the given rectangle.
WriteString Appends AValue as raw bytes to the current content stream.
WriteStrokeColor Emits a PDF stroking colour operator (RG or SC) for the given stroke colour.
WriteStrokeKind Emits a PDF line dash pattern operator (d) that matches the given stroke kind.
WriteStrokeWidth Emits a PDF line width operator (w) for the given stroke width.
WriteTextMatrix Emits a PDF Tm (text matrix) operator with the six transformation components.

Events

Name Description
OnFontChanged Fired when the active font properties change, allowing the caller to re-emit a Tf operator.
OnNotifyBitmap Fired when a bitmap needs to be embedded, allowing the caller to supply a PDF image resource reference from the document-level image cache.
OnNotifyGoTo Fired when a named-destination internal link is emitted, allowing the caller to register it in the PDF annotation list.
OnNotifyGoTo2 Fired when a page-index internal link is emitted, allowing the caller to register it in the PDF annotation list.
OnNotifyShading Fired when a gradient fill shading resource is needed, allowing the caller to register or look up the shading in the resource dictionary.
OnNotifyShadingRect Fired to pass the bounding rectangle of a gradient fill to the caller for use in the shading XObject.
OnNotifyText Fired when text content is added, allowing the caller to capture plain text for accessibility or search.
OnNotifyURL Fired when a hyperlink annotation is emitted, allowing the caller to register it in the PDF annotation list.
OnNotifyUnicode Fired when Unicode text is added, allowing the caller to build a ToUnicode CMap for the embedded font.