p2m

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: GPL-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// PathTypeEoFill ...
	PathTypeEoFill PathType = 10
	// PathTypeStroke ...
	PathTypeStroke = 11
	// PathTypeFill ...
	PathTypeFill = 12
	// PathTypeSetStrokeColor ...
	PathTypeSetStrokeColor = 13
	// PathTypeSetStrokeWidth ...
	PathTypeSetStrokeWidth = 14
	// PathTypeSetFillColor ...
	PathTypeSetFillColor = 15
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FontInfo

type FontInfo struct {
	Name                        string
	Type                        string
	Encoding                    string
	Embedded, Subset, ToUnicode bool
}

FontInfo contains information about a font in the file.

func (*FontInfo) DecodeMsg

func (z *FontInfo) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*FontInfo) EncodeMsg

func (z *FontInfo) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*FontInfo) MarshalMsg

func (z *FontInfo) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*FontInfo) Msgsize

func (z *FontInfo) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*FontInfo) UnmarshalMsg

func (z *FontInfo) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type FontInfos

type FontInfos []FontInfo

FontInfos is a list of font information.

func (*FontInfos) DecodeMsg

func (z *FontInfos) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (FontInfos) EncodeMsg

func (z FontInfos) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (FontInfos) MarshalMsg

func (z FontInfos) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (FontInfos) Msgsize

func (z FontInfos) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*FontInfos) UnmarshalMsg

func (z *FontInfos) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Glyph

type Glyph struct {
	Rect Rect
	Text string
}

Glyph represents a single glyph.

func (*Glyph) DecodeMsg

func (z *Glyph) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Glyph) EncodeMsg

func (z *Glyph) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Glyph) MarshalMsg

func (z *Glyph) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Glyph) Msgsize

func (z *Glyph) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*Glyph) UnmarshalMsg

func (z *Glyph) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Meta

type Meta struct {
	Pages                       int64
	FileName, Creator, Producer string

	FontInfo *FontInfos
}

Meta contains metadata about the PDF such as the number of pages.

func (*Meta) DecodeMsg

func (z *Meta) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Meta) EncodeMsg

func (z *Meta) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Meta) MarshalMsg

func (z *Meta) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Meta) Msgsize

func (z *Meta) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*Meta) UnmarshalMsg

func (z *Meta) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Page

type Page struct {
	Bytes         int64 // Number of bytes of MsgPack
	ParseDuration time.Duration

	Number int // One based.
	Size   Size
	Glyphs []Glyph
	Paths  []Path
}

Page represents one page of a PDF.

func (*Page) DecodeMsg

func (z *Page) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Page) EncodeMsg

func (z *Page) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Page) MarshalMsg

func (z *Page) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Page) Msgsize

func (z *Page) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*Page) UnmarshalMsg

func (z *Page) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Path

type Path struct {
	Type        PathType
	Data        [][]float64
	StrokeWidth float64
	Color       struct{ R, G, B uint8 }
}

Path represents a path.

func (*Path) DecodeMsg

func (p *Path) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Path) EncodeMsg

func (z *Path) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Path) MarshalMsg

func (z *Path) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Path) Msgsize

func (z *Path) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*Path) UnmarshalMsg

func (z *Path) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PathType

type PathType uint8

PathType is one of a set of constants which describes paths.

func (*PathType) DecodeMsg

func (z *PathType) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (PathType) EncodeMsg

func (z PathType) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (PathType) MarshalMsg

func (z PathType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PathType) Msgsize

func (z PathType) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*PathType) UnmarshalMsg

func (z *PathType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Reader

type Reader struct {
	Version int
	Meta    Meta

	R *msgp.Reader
	// contains filtered or unexported fields
}

Reader reads pdf2msgpack's output stream.

func NewReader

func NewReader(r io.Reader) (*Reader, error)

NewReader reads the header and metadata from a pdf2msgpack stream. To read pages, call Next() repeatedly until io.EOF.

func (*Reader) Next

func (r *Reader) Next(p *Page) error

Next reads the next page into p, or returns io.EOF.

type Rect

type Rect struct {
	X1, Y1, X2, Y2 float64
}

Rect represents a rectangle.

func (*Rect) DecodeMsg

func (z *Rect) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Rect) EncodeMsg

func (z *Rect) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Rect) MarshalMsg

func (z *Rect) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Rect) Msgsize

func (z *Rect) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*Rect) UnmarshalMsg

func (z *Rect) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Size

type Size struct {
	W, H float64
}

Size of the page.

func (*Size) DecodeMsg

func (z *Size) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Size) EncodeMsg

func (z Size) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Size) MarshalMsg

func (z Size) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Size) Msgsize

func (z Size) Msgsize() (s int)

Msgsize returns the number of bytes occupied by the serialized message

func (*Size) UnmarshalMsg

func (z *Size) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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