gofastrtf

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-fast-rtf

Extracts RTF documents (Microsoft's Rich Text Format, specification 1.9.1) into the shared go-fast document model, gofastcore.Document. Standard library and go-fast modules only.

Status: v0.2.0 (2026-11-23). Built on go-fast-core v0.1.2 (schema 0.2).

Using it

import (
	"github.com/AOShei/go-fast-core" // package gofastcore
	"github.com/AOShei/go-fast-rtf"  // package gofastrtf
)

doc, err := gofastrtf.ExtractFile(ctx, "letter.rtf", nil)
if err != nil {
	return err // wraps gofastcore.ErrMalformed, ErrLimitExceeded, ...
}
fmt.Println(doc.Markdown())

gofastrtf.Extract(ctx, r, size, opts) reads from an io.ReaderAt. gofastrtf.Extractor implements gofastcore.Extractor; its one field, MaxGroupDepth, bounds how deeply groups may nest. The file is read as a stream: only the document being built, and the picture or object being read, are held in memory. The exception is a document that declares \fromhtml1: its encapsulated HTML is held in memory whole, up to Limits.MaxDecodedBytes, to be handed to Options.Child. The input is read twice: a first pass looks for \fromhtml1 and de-encapsulates the HTML (it stops at the first content of a document that does not declare it), then the RTF is read from the start.

The format is decided from the content: the file must begin, after white space or a byte order mark, with {\rtf. Anything else is ErrMalformed.

How it maps

A document has one part of kind body, part 1. When the file stores data it never shows, a second part of kind stored follows it (see below); Options.Parts selects it only with the whole document.

RTF Block
\par ends a paragraph; \line is \n, \tab a tab, both kept in the text
\outlinelevelN, a paragraph style named heading N or with an outline level (followed through \sbasedon) heading, level N+1 for \outlinelevelN; levels 7 to 9 are clamped to 6 with Attrs["level"] and structure.heading_level_clamped
\listtext, \pntext the Marker of a list_item (or of a numbered heading); level from \ilvl, or \pnlvlN; Ordered from the list table's \levelnfc for \ls, from \pn settings, or from the marker
\ls without \listtext list_item with no marker (numbers are not computed)
\trowd, \cellx, \cell, \row table; \clmgf/\clmrg and \clvmgf/\clvmrg become Merges; leading \trhdr rows are HeaderRows; several paragraphs in a cell are joined by \n
\itapN, \nestcell, \nestrow a nested table is written into the cell that holds it, a line per row, cells separated by tabs
\footnote footnote after its paragraph, paragraphs joined by \n; Marker is its number (\chftn) in the document's format (\ftnnar, \aftnnrlc, ...): arabic for footnotes, lower-case roman for endnotes (\ftnalt) unless the document says otherwise
\annotation with \atnauthor/\atnid, \atndate note of type comment, with author and date
\deleted left out of the text and kept as a note of type deletion with author (\revauthdel and the revision table) and date (\revdttmdel); text.tracked_changes
\field the result (\fldrslt) is in the text; the instruction (\fldinst) is a note of type field, with no display reason and Attrs["stored"] = "field_code" (Markdown and text leave it out unless -stored or -stored=field_code, as for .docx); \xe, \tc and \tcn entries are such notes too (XE entry, TC entry); a field nested in an instruction is written into it as { ... }
HYPERLINK field with Options.Spans, a span with Href over the result (\l gives #anchor); in a table cell, Table.Cells[].Href
\pict image after its paragraph: Image.ID pict-N, MIME from \pngblip, \jpegblip, \emfblip, \wmetafile, \macpict, \dibitmap, \wbitmap; pixel size from the PNG or JPEG header, or \picw/\pich for bitmaps; alt text from wzDescription of \picprop or of the shape. \nonshppict and \shprslt (copies for old readers) are skipped
\shptxt, \dptxbxtext the text of a text box (of a shape, or of a Word 6/95 drawing object \do): its blocks follow the paragraph the shape is in
\object the object's \result is read as content; the embedded data (\objdata, an OLE 1.0 stream) is handed to Options.Child, unpacked from a Package to the file it packages; linked objects are listed, not read
paragraph borders (\brdrb, \box, ...) not read. An empty paragraph with only a bottom border gives no block, as any empty paragraph: a border is not a declared break, and no thematic_break is inferred from it. A bordered paragraph with text, and a * * * paragraph, stay paragraphs. RTF has no paragraph-level horizontal-rule control word; a thematic_break is emitted only where the file itself declares one: Word's horizontal line, a shape or inline picture with the property fHorizRule (Origin native, in place of the line's picture)
\fromhtml1 (HTML encapsulated by Outlook, [MS-OXRTFEX]) the HTML is de-encapsulated (the \*\htmltag groups and the text outside \htmlrtf runs; \par and \line as CRLF, \tab as a tab, \'hh as that byte, \uN as UTF-8 under \ansicpg65001 and as &#N; otherwise) and handed to Options.Child as body.html, text/html; charset= the WHATWG label of \ansicpg (no charset for a code page with none); it is the first of Children. When the child comes back extracted with blocks, the body gives no blocks (the HTML is the message; the RTF only repeats it); otherwise the RTF is read as usual. This library does not read HTML: the caller's Options.Child must, as go-fast-email's command does; gofastrtf does not, so it shows the RTF reading. \fromtext is read as RTF
\header*, \footer* header, footer blocks where they stand
\*\formfield with \*\ffl note of type choices, one value per line, Attrs["field"] from \*\ffname; it follows the paragraph
\*\bkmkstart at the start of a paragraph Loc.Anchor
\info Metadata: title, subject, author (one entry), keywords (one entry), creatim, revtim; operator, company, manager, category, comment, doccomm, hlinkbase, printim (printed), buptim (backed_up) in Extra; \deflang gives Language for common languages
\*\generator Metadata.Application, and a stored block

Text is decoded through \uN (with the \ucN fallback bytes skipped, surrogate pairs joined) and \'hh through the code page of the current font (\cpgN, else \fcharsetN) or of the document (\ansicpgN, \ansi, \mac). Single-byte code pages 874, 1250 to 1258 and Mac Roman (10000) are decoded, UTF-8 (65001), and the double-byte code pages 932 (Japanese), 936 (Simplified Chinese), 949 (Korean) and 950 (Traditional Chinese), in \'hh escapes and in raw 8-bit bytes alike; a lead byte and its trail byte may come in two escapes. The user-defined areas, which the tables leave out, are computed as Windows maps them: in 932, lead bytes 0xF0 to 0xF9 to U+E000 to U+E757, and byte 0x80 alone is U+0080; in 936, 0xAAA1 to 0xAFFE, 0xF8A1 to 0xFEFE and 0xA140 to 0xA7A0 to U+E000 to U+E765. A pair the table does not map, and a lead byte with no trail byte, are one U+FFFD each, and text.unmapped_glyphs names the code page. Other code pages (437, 850, Johab, ...) are not decoded. The ligatures U+FB00 to U+FB06 (Mac Roman has two) are written as their letters.

Destinations marked \* that this library does not know are skipped, as the specification asks. So are theme data, the colour scheme map, the data store, latent styles, rsid tables and the like, which hold no text.

What the file declares

Everything the file contains is extracted. A block, span or table region carries a display reason (Block.Display, JSON display) only where the file states outright that its text is not shown. RTF declares this:

Reason Declared by
hidden \v (hidden text) on the run, or set by a paragraph style (\sN) or a character style (\csN) of the \stylesheet, followed through \sbasedon. The style's \v applies where \s or \cs stands; \v0 written after it wins, and \plain ends it. Also the shape property fHidden set to true ({\sp{\sn fHidden}{\sv 1}}, wherever it stands in the shape): every block of the shape's text box (\shptxt) and its pictures carry hidden on the whole block, and so do those of the shapes in a hidden group (\shpgrp). {\sv 0} gives nothing
no_ink none. RTF has no control that draws text with no paint: character colour (\cf) is a colour-table entry with no transparency, and outline, emboss and shadow effects still draw the letters

A hidden passage of a paragraph is a span with display set; a paragraph hidden throughout carries the reason on the block. In a table, a cell that holds hidden text is a Table.Display region. A comment's or footnote's hidden passages are spans like a paragraph's. RenderOptions.ExcludeDisplay (the command's -exclude-display) leaves such text out of Markdown and plain text.

Not reported, because the file does not declare them: the colour of text against what is behind it, the size of text (\fs0 included), where a shape is placed and what it covers. Colour, size, position and overlap are not judged. Nor is \webhidden, which hides text only in Word's Web Layout and on web pages, a condition: Word puts it on the page numbers of every table of contents, which the document shows.

Data the file keeps without showing it has no reason either, and stays where its provenance puts it: field instructions, and index and table-of-contents entries (\xe, \tc, \tcn), are note blocks of type field after their paragraph, written as Word writes the field (XE entry, TC entry), each with Attrs["stored"] = "field_code", so that Markdown and text leave them out unless stored data of that kind is asked for, as go-fast-ooxml does for .docx; tracked deletions are note blocks of type deletion, the text being given as if the changes were accepted; document properties are metadata; the rest is in the stored part.

Characters that display as nothing (zero-width characters, Unicode tag characters, bidirectional controls, variation selectors) are kept in the text as the file has them.

The library reports what the file declares about its content; it does not judge whether text is visible or harmful, and the absence of a reason says nothing about either. Threat detection is outside this library.

The stored part

What belongs to the file and is shown on no page goes to the stored part, which carries no reason (the renderers leave it out unless RenderOptions.Stored or RenderOptions.StoredKinds, the command's -stored[=kinds]), each block with Attrs["stored"]. Field notes in the body carry Attrs["stored"] = "field_code" and are left out the same way. In the stored part:

stored What
generator \*\generator, the program that wrote the file
document_variable \*\docvar {name}{value}, as name: value, with Attrs["name"]
custom_property \*\userprops: \propname and \staticval, as name: value
after_end text after the closing brace of the document. The part carries input.trailing_data, whose message gives the number of bytes after the brace. White space, NUL bytes and 0x1A (Ctrl-Z, the DOS end-of-file mark) alone there are not data: they give neither a block nor the warning. Any other byte counts, however few

Warnings

Besides the shared codes (limit.exceeded, part.no_text, part.image_only, child.*):

Code Severity What happened
input.repaired info the file ends inside open groups; it was read as far as it goes
input.external_reference warning a linked object, an INCLUDEPICTURE, INCLUDETEXT, INCLUDE, LINK or IMPORT field, a remote \*\template; nothing was fetched
input.active_content warning a DDE or DDEAUTO field, an ActiveX control (\objocx); nothing was run
text.tracked_changes info the document has insertions (\revised) or deletions (\deleted)
text.unmapped_glyphs warning bytes in a code page that is not decoded, bytes their code page leaves undefined, bytes above 0x7F in a Symbol font (\fcharset2) other than 0xB7, unpaired surrogates. One warning for the body: with more than one code page it gives the total, says what happened in each of the first eight (in the order of their numbers) and counts the rest. The first 64 code pages met are counted one by one; past them the rest are counted together, and the message says "at least" so many more
image.unsupported_encoding warning with ImagesData, a picture in a format whose bytes cannot be given as a file (device-dependent bitmap, OS/2 metafile, no format named)
input.trailing_data info data follows the document's closing brace; the message gives how many bytes. Its text is in the stored part as after_end. On the document when there is no stored part to carry it
input.unread_content warning content this version does not read: equations (\mmath); the message names it with the count
text.control_characters_removed info control characters with no meaning as text (in \'xx, \uN or the bytes of the text) were removed, in the body or the metadata; the message gives the count. Raw line breaks in the source are not text and are not counted

This library has no codes of its own. rtf.unread_content and rtf.control_characters_removed, before v0.2.0, are the two shared codes above; the Go names WarnUnreadContent and WarnControlCharsRemoved are deprecated and have the shared values.

Limits

Limit Default What it bounds
Limits.MaxInputBytes 1 GiB the file; larger is ErrLimitExceeded
Limits.MaxTextBytes 256 MiB (core) text of blocks, cells, markers and link targets, with BlockCost and CellCost, shared with embedded documents; the body is cut off at the limit with limit.exceeded
Limits.MaxDecodedBytes 1 GiB picture bytes kept with ImagesData, embedded object data and encapsulated HTML handed to Options.Child, shared with embedded documents; past it, pictures have no data and objects are listed, not read
Extractor.MaxGroupDepth 1024 nesting of groups; deeper groups are not read, with limit.exceeded
Limits.MaxDepth 4 (core) nesting of embedded documents

Smaller fixed bounds: a field instruction or index entry holds 32 KiB, a metadata item 64 KiB, the generator (\*\generator) 4 KiB, a document variable's or custom property's name 1 KiB and value 64 KiB, a tracked deletion 1 MiB, a comment author 1 KiB, a form field's name or choice 4 KiB, a picture's or shape's description 64 KiB, a bookmark name and a list marker 256 bytes, an embedded object's name 1 KiB and class 256 bytes, a packaged file's label (which names the child) 4 KiB, a comment date (\atndate) 32 bytes, a revision author 512 bytes; 16,384 document variables, as many custom properties and as many revision authors are kept, 65,536 fonts, paragraph styles, character styles, lists and list overrides each, and 1,024 choices of one form field; fields nest at most 256 deep; the text after the document's end holds 1 MiB; a table has at most 1,048,576 rows, and a row definition gives the merges of at most 4,096 cells (\cellx; the text of the cells past them is read). A bound that cuts or leaves out content gives one limit.exceeded warning (severity error) for each bound, saying how many items it cut or left out and, for text, how many bytes: on the body for what goes to the body, on the stored part for stored data (on the document when there is no stored part), and on the document for metadata and the names of embedded objects. Without ImagesData, at most 64 KiB of a picture is decoded, to read its size.

Other bounds apply to data that is only used inside the library, never given, and say nothing: a style name is read up to 512 bytes, only to find "heading N"; a shape property's name up to 256 bytes, and the values of fHidden and fHorizRule, to match and read them; \*\template up to 2 KiB, only to see whether it is remote; the first 64 words of a field instruction, to find a HYPERLINK target and the fields counted in warnings; nine levels of a list definition; a control word's name up to 32 letters and its number up to 10 digits, a longer number being taken as the largest 32-bit one (the specification bounds both more tightly); font names are not read. Table nesting deeper than 64 is taken as 64.

What is not read

  • Code pages other than those listed above (437, 850, Johab 1361, ...).
  • Fonts with \fcharset2 (Symbol and other symbol fonts) are not mapped to the characters they draw: bytes below 0x80 are given as ASCII, and bytes above 0x7F are U+FFFD with text.unmapped_glyphs, except 0xB7, a bullet (U+2022).
  • List numbers are not computed: the marker is what \listtext or \pntext says, which Word always writes.
  • Equations (\mmath), the default text and help text of form fields, drawing objects other than text boxes and pictures, \pmmetafile data.
  • WordArt: its text, the shape property gtextUNICODE, is not read.
  • Bold, italic and other inline styles set only by a style are not given as spans (a style's \v is read; see above).

The command

go install github.com/AOShei/go-fast-rtf/cmd/gofastrtf@latest
gofastrtf report.rtf                       # JSON
gofastrtf -format markdown -exclude-display docs/

-format (json, the default, markdown or text), -images, -spans, -max-group-depth, -max-decoded-bytes, -max-text-bytes, -quiet, -o, -version; gofastrtf -h lists them. The render flags are the same in every go-fast command and affect Markdown and text only; JSON always has everything:

Flag Effect
-furniture in Markdown and text, include running headers and footers
-stored[=kinds] in Markdown and text, include stored data (data the file keeps but shows nowhere): all of it (-stored, =true, =all), or with =kinds only those kinds, comma- or +-separated (core's StoredKindNames(); those RTF writes are field_code, document_variable, after_end, generator and custom_property). =false or = turn it off; an unknown kind is an error listing the kinds, exit status 2
-part-markers in Markdown and text, put a line before each part saying which part it is
-children (default true) in Markdown and text, include embedded documents (here, objects the command reads: embedded RTF files), each after a line naming it ([child 1: name] in text, <!-- child 1: name --> in Markdown); a child that was not read gives only that line; -children=false leaves them out
-exclude-display[=reasons] in Markdown and text, leave out what the file declares not displayed: all of it (alone, =true or =all), or with =reasons only those reasons (hidden, no_ink, joined by , or +); =false or = turns it off, and any other value, unknown included, is an error

Messages go to standard error; the exit status is 1 if a file could not be read.

Layout

Path What
extract.go Extractor, Extract, ExtractFile, warning codes, limits
internal/token the tokenizer
internal/codepage code page tables and decoder
internal/htmlrtf de-encapsulation of HTML (\fromhtml1)
internal/reader groups, destinations and the blocks they become
cmd/gofastrtf the command

Running the tests

go test -short ./...
go test -run XXX -fuzz FuzzExtract -fuzztime=20s .
go test -run XXX -fuzz FuzzLexer -fuzztime=20s ./internal/token
go test -run TestCorpus -v .                  # with the public corpus
go test -run XXX -bench BenchmarkExtract .    # with the public corpus

Every fixture is written by the tests themselves. TestCorpus and BenchmarkExtract read the series' public corpus (GOFAST_CORPUS, or ../.testdata/corpus) and are skipped without it; no corpus file is in this repository.

Licence

MIT. The code page tables are the content of the Unicode Consortium's mapping files; see NOTICE.

Documentation

Overview

Package gofastrtf extracts RTF documents into the shared document model of the go-fast libraries (github.com/AOShei/go-fast-core).

A document has one part, the body (part 1), and after it, when the file stores data it never shows (document variables, custom properties, the name of the program that wrote it, text after the document's closing brace, as after_end), a stored part. Stored data carries no display reason.

doc, err := gofastrtf.Extract(ctx, f, size, nil)
if err != nil {
	return err
}
fmt.Println(doc.Markdown())

Headings come from \outlinelevel and from styles named "heading N" or with an outline level; list items from \listtext and \pntext, whose text is the marker, and \ls; tables from \trowd, \cell and \row, with merges; footnotes and endnotes are footnote blocks after their paragraph; comments, tracked deletions and field instructions are note blocks; Word's horizontal line (the shape property fHorizRule) is a thematic_break with Origin native.

Everything the file contains is extracted. RTF's display declarations, hidden text (\v, on the run or through a style) and a shape's fHidden, are reported as gofastcore.DisplayHidden; nothing else about visibility is judged.

A document that declares \fromhtml1 (HTML mail as Outlook stores it, [MS-OXRTFEX]) has its HTML de-encapsulated and handed to Options.Child as HTMLName (body.html), with the MIME type text/html and, as its charset, the WHATWG label of the document's code page (\ansicpg, or 1252 when none is named) when that code page has one. It is the first of the document's children. When the child comes back with blocks, the body gives none; otherwise the RTF is read as usual. This library does not read HTML itself.

Index

Constants

View Source
const (
	// StoredGenerator: the program that wrote the document (\generator).
	StoredGenerator = gofastcore.StoredGenerator
	// StoredCustomProperty: a custom document property (\userprops),
	// with its name in Attrs["name"].
	StoredCustomProperty = gofastcore.StoredCustomProperty
)

Values of Attrs["stored"] particular to RTF. They are core's values, gofastcore.StoredGenerator and gofastcore.StoredCustomProperty.

View Source
const (
	// DefaultMaxInputBytes bounds the size of the file.
	DefaultMaxInputBytes = 1 << 30
	// DefaultMaxDecodedBytes bounds the bytes decoded from the hexadecimal
	// or binary data of pictures and embedded objects that are kept: the
	// pictures' bytes when Options.Images is ImagesData, and the embedded
	// objects handed to Options.Child.
	DefaultMaxDecodedBytes = 1 << 30
	// DefaultMaxGroupDepth bounds how deeply groups may nest. Groups
	// nested deeper are not read, and the body carries limit.exceeded.
	DefaultMaxGroupDepth = 1024
)

Defaults for the limits of gofastcore.Options.Limits, used where a limit is zero. A negative limit means no limit.

View Source
const (
	// WarnUnreadContent was rtf.unread_content, raised when the file
	// holds content of a kind this version does not read (an equation).
	//
	// Deprecated: the event is go-fast-core's shared code
	// input.unread_content (gofastcore.WarnInputUnreadContent) since
	// v0.2.0; this name has that value.
	WarnUnreadContent = gofastcore.WarnInputUnreadContent
	// WarnControlCharsRemoved was rtf.control_characters_removed, raised
	// when control characters with no meaning as text were removed.
	//
	// Deprecated: the event is go-fast-core's shared code
	// text.control_characters_removed
	// (gofastcore.WarnTextControlCharactersRemoved) since v0.2.0; this
	// name has that value.
	WarnControlCharsRemoved = gofastcore.WarnTextControlCharactersRemoved
)

Warning codes. This library raises only the codes shared by all go-fast libraries (gofastcore); besides the ones about parts, limits and embedded documents, these:

text.control_characters_removed  control characters with no meaning as
                          text were removed; the message gives the count
input.unread_content      content this version does not read (an
                          equation); the message names it
input.active_content      a DDE or DDEAUTO field, or an ActiveX control
input.external_reference  a linked object, an INCLUDEPICTURE,
                          INCLUDETEXT, INCLUDE, LINK or IMPORT field, a
                          remote template
input.repaired            the file ends before its groups are closed
text.tracked_changes      the document has tracked changes
text.unmapped_glyphs      bytes in a code page that is not decoded, or
                          with no character in their code page
input.trailing_data       data follows the document's closing brace; its
                          text is in the stored part as after_end
image.unsupported_encoding
structure.heading_level_clamped
View Source
const HTMLName = "body.html"

HTMLName is the name of the HTML that a document declaring \fromhtml1 encapsulates, as it is handed to Options.Child.

Variables

This section is empty.

Functions

func Extract

func Extract(ctx context.Context, r io.ReaderAt, size int64, opts *gofastcore.Options) (*gofastcore.Document, error)

Extract reads an RTF file with default settings. It is (&Extractor{}).Extract.

func ExtractFile

func ExtractFile(ctx context.Context, path string, opts *gofastcore.Options) (*gofastcore.Document, error)

ExtractFile opens the named file and extracts it, with default settings.

Types

type Extractor

type Extractor struct {
	// MaxGroupDepth bounds how deeply groups may nest. Zero means
	// DefaultMaxGroupDepth; negative means no limit other than the
	// memory it takes.
	MaxGroupDepth int
}

Extractor extracts RTF files. The zero value is ready to use and safe for concurrent use. Its fields are the settings that only this library has; everything else is in gofastcore.Options.

func (*Extractor) Extract

func (e *Extractor) Extract(ctx context.Context, r io.ReaderAt, size int64, opts *gofastcore.Options) (*gofastcore.Document, error)

Extract reads size bytes from r and returns the document.

The format is decided from the content: the file must begin, after any white space or byte order mark, with "{\rtf". An error wraps one of the gofastcore errors:

  • ErrMalformed: the input is not an RTF file.
  • ErrLimitExceeded: the input is larger than Limits.MaxInputBytes.
  • ErrNoPartsSelected: Options.Parts does not select the body, which is part 1.

func (*Extractor) ExtractFile

func (e *Extractor) ExtractFile(ctx context.Context, path string, opts *gofastcore.Options) (*gofastcore.Document, error)

ExtractFile opens the named file and extracts it. The file name is recorded as the document's source name unless opts.Name is set.

func (*Extractor) Formats

func (e *Extractor) Formats() []string

Formats lists the formats this library extracts, as they appear in gofastcore.Source.Format.

Directories

Path Synopsis
cmd
gofastrtf command
Command gofastrtf extracts RTF files into the shared document model of the go-fast libraries and prints them as JSON, Markdown or plain text.
Command gofastrtf extracts RTF files into the shared document model of the go-fast libraries and prints them as JSON, Markdown or plain text.
internal
codepage
Package codepage turns the bytes of RTF text (\'hh escapes and 8-bit text) into Unicode, for the code pages RTF names with \ansicpgN, \cpgN and \fcharsetN.
Package codepage turns the bytes of RTF text (\'hh escapes and 8-bit text) into Unicode, for the code pages RTF names with \ansicpgN, \cpgN and \fcharsetN.
htmlrtf
Package htmlrtf de-encapsulates HTML from RTF that encapsulates it, as Outlook stores HTML mail ([MS-OXRTFEX]): the document declares \fromhtml1 in its header, the HTML's markup is in {\*\htmltagN ...} groups, the HTML's text is between them, and \htmlrtf ...
Package htmlrtf de-encapsulates HTML from RTF that encapsulates it, as Outlook stores HTML mail ([MS-OXRTFEX]): the document declares \fromhtml1 in its header, the HTML's markup is in {\*\htmltagN ...} groups, the HTML's text is between them, and \htmlrtf ...
reader
Package reader reads the tokens of an RTF file into the shared document model: the group stack with its character and paragraph properties, the destinations, and what each one becomes.
Package reader reads the tokens of an RTF file into the shared document model: the group stack with its character and paragraph properties, the destinations, and what each one becomes.
token
Package token splits an RTF stream into tokens: group delimiters, control words, control symbols, runs of text, hexadecimal bytes (\'hh) and binary data (\binN).
Package token splits an RTF stream into tokens: group delimiters, control words, control symbols, runs of text, hexadecimal bytes (\'hh) and binary data (\binN).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL