rtf

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 19 Imported by: 0 modules, 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.

Documentation

Overview

Package rtf opens files in the Rich Text Format, as RTF 1.9.1 of Microsoft describes it.

The package converts the text of the file into one XHTML document with a style sheet, and the layout of ivy puts it on pages (D10, D15). Page lays out the document only as far as the page that a program asks for. The package reads the fonts, the colors, the formatting of the characters and of the paragraphs, the tables, the pictures in PNG, JPEG, EMF and WMF, the sections with their pages and margins, the headers and the footers, the footnotes, the fields with their last result, and the text in each code page of the Encoding Standard and in Unicode. The tables have their merged cells and the tables that nest in their cells. A paragraph and a run take the formatting of their styles of the style sheet first. A run gives its East Asian font of \dbch after its font, and the language of its East Asian text. The WordArt of a header, such as a watermark, shows on each page. A rendering is good enough for a review (D5).

Index

Constants

This section is empty.

Variables

View Source
var Format = ivy.Format{
	Name:  "rtf",
	Mimes: []string{"application/rtf", "text/rtf"},
	Exts:  []string{"rtf"},
	Open: func(ctx context.Context, src ivy.Source, cfg ivy.Config) (ivy.Document, error) {
		return Open(ctx, src, WithConfig(cfg))
	},
}

Format describes the package for the registry of a program.

Functions

This section is empty.

Types

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document is an open RTF file.

func Open

func Open(ctx context.Context, src ivy.Source, opts ...Option) (d *Document, err error)

Open opens an RTF file. It reads the file, and converts it on the first call that needs its text. It returns an error that wraps ivy.ErrFormat if src is not an RTF file, and one that wraps ivy.ErrLimit if the file is larger than Limits.MaxMemory.

func (*Document) Close

func (d *Document) Close() error

Close satisfies the ivy.Document interface.

func (*Document) Describe

func (d *Document) Describe(ctx context.Context) (info ivy.Info, err error)

Describe satisfies the ivy.Describer interface. It reads the group \info of the file: the title, the author, the subject and the dates.

func (*Document) Page

func (d *Document) Page(ctx context.Context, n int) (p ivy.Page, err error)

Page satisfies the ivy.Pager interface. It lays out the document only as far as page n, from 0.

func (*Document) PageCount

func (d *Document) PageCount(ctx context.Context) (n int, err error)

PageCount satisfies the ivy.Pager interface. It lays out the whole document on its first call.

type Option

type Option func(*options)

Option is an option of Open.

func WithConfig

func WithConfig(cfg ivy.Config) Option

WithConfig sets the configuration that every format shares.

Jump to

Keyboard shortcuts

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