stext

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	BBox  geometry.Rect
	Lines []Line `xml:"line"`
}

func (*Block) UnmarshalXML

func (b *Block) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Char

type Char struct {
	C      rune
	Bounds geometry.Rect
}

func (*Char) UnmarshalXML

func (c *Char) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Document

type Document struct {
	Name  string `xml:"name,attr"`
	Pages []Page `xml:"page"`
}

func DocumentFromXML

func DocumentFromXML(r io.Reader) (*Document, error)

DocumentFromXML unmarshals a document from the XML structure used for mutool's "stext" output format.

func DocumentFromXMLFile

func DocumentFromXMLFile(path string) (_ *Document, err error)

DocumentFromXMLFile is the same as DocumentFromXML, but reads the contents from a file.

func (*Document) Unmarshal

func (d *Document) Unmarshal(r io.Reader) error

type FontSpan

type FontSpan struct {
	FontName string          `xml:"name,attr"`
	FontSize geometry.Length `xml:"size,attr"`
	Chars    []Char          `xml:"char"`
}

type Line

type Line struct {
	BBox      geometry.Rect
	FontSpans []FontSpan `xml:"font"`
}

func (*Line) UnmarshalXML

func (l *Line) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Page

type Page struct {
	ID     string          `xml:"id,attr"`
	Width  geometry.Length `xml:"width,attr"`
	Height geometry.Length `xml:"height,attr"`
	Blocks []Block         `xml:"block"`
}

Jump to

Keyboard shortcuts

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