rtf

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RTFCompressedMagic   = 0x75465A4C // "LZFu" – compressed payload
	RTFUncompressedMagic = 0x414C454D // "MELA" – raw RTF follows the header
)

Variables

This section is empty.

Functions

func DeEncapsulateHTML

func DeEncapsulateHTML(rtf []byte) string

DeEncapsulateHTML extracts the original HTML from \fromhtml RTF.

func Decompress

func Decompress(data []byte) ([]byte, error)

Decompress inflates a PidTagRtfCompressed stream into raw RTF bytes.

A stream cut short in the middle of a token is not reported as an error. The control-byte loop carries no length of its own, so running out of source bytes mid-literal or mid-back-reference is the same code path as a clean end of stream, and the only field that could tell them apart is the sender's own rawSize. Callers get the prefix that was decoded and a nil error; a caller that needs to know whether the stream was whole must check it themselves.

func IsEncapsulatedHTML

func IsEncapsulatedHTML(rtf []byte) bool

IsEncapsulatedHTML reports whether decompressed RTF carries HTML produced by Outlook (\fromhtml1 in the header).

Types

This section is empty.

Jump to

Keyboard shortcuts

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