Documentation ¶
Index ¶
- Variables
- type Length
- type Orientation
- func (enum Orientation) Dimensions(width, height Length) (adjustedWidth, adjustedHeight Length)
- func (enum Orientation) EnsureValid() Orientation
- func (enum Orientation) Key() string
- func (enum Orientation) MarshalText() (text []byte, err error)
- func (enum Orientation) String() string
- func (enum *Orientation) UnmarshalText(text []byte) error
- type Size
- type Units
Constants ¶
This section is empty.
Variables ¶
var ( // AllOrientation holds all possible values. AllOrientation = []Orientation{ Portrait, Landscape, } )
var ( // AllSize holds all possible values. AllSize = []Size{ Letter, Legal, Tabloid, A0, A1, A2, A3, A4, A5, A6, } )
var ( // AllUnits holds all possible values. AllUnits = []Units{ Inch, Centimeter, Millimeter, } )
Functions ¶
This section is empty.
Types ¶
type Length ¶
Length contains a real-world length value with an attached units.
func LengthFromString ¶
LengthFromString creates a new Length. May have any of the known units.Units suffixes or no notation at all, in which case units.Inch is used.
func ParseLengthFromString ¶
ParseLengthFromString parses a Length from the text. May have any of the known units.Units suffixes or no notation at all, in which case units.Inch is used.
func (*Length) EnsureValidity ¶
func (l *Length) EnsureValidity()
EnsureValidity checks the current settings for validity and if they aren't valid, makes them so.
func (Length) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Length) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Orientation ¶
type Orientation byte
Orientation holds the orientation of the page.
const ( Portrait Orientation = iota Landscape LastOrientation = Landscape )
Possible values.
func ExtractOrientation ¶
func ExtractOrientation(str string) Orientation
ExtractOrientation extracts the value from a string.
func (Orientation) Dimensions ¶
func (enum Orientation) Dimensions(width, height Length) (adjustedWidth, adjustedHeight Length)
Dimensions returns the paper dimensions after orienting the paper.
func (Orientation) EnsureValid ¶
func (enum Orientation) EnsureValid() Orientation
EnsureValid ensures this is of a known value.
func (Orientation) Key ¶
func (enum Orientation) Key() string
Key returns the key used in serialization.
func (Orientation) MarshalText ¶
func (enum Orientation) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (*Orientation) UnmarshalText ¶
func (enum *Orientation) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Size ¶
type Size byte
Size holds a standard paper dimension.
func (Size) Dimensions ¶
Dimensions returns the paper dimensions.
func (Size) EnsureValid ¶
EnsureValid ensures this is of a known value.
func (Size) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Size) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Units ¶
type Units byte
Units holds the real-world length unit type.
const ( Inch Units = iota Centimeter Millimeter LastUnits = Millimeter )
Possible values.
func ExtractUnits ¶
ExtractUnits extracts the value from a string.
func (Units) EnsureValid ¶
EnsureValid ensures this is of a known value.
func (Units) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (Units) ToPixels ¶
ToPixels converts the given length in this Units to the number of 72-pixels-per-inch pixels it represents.
func (*Units) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.