Orientation constant definitions.
const ( Portrait = Orientation(false) Landscape = Orientation(true) )
func MarshalPageSize(p PageSize) (string, error)
MarshalPageSize marshals the page size into string.
func MarshalUnit(unit Length) (string, error)
MarshalUnit marshals the unit into the string.
Inch is a unit that
type Inch float64
func UnmarshalInch(unit string) (Inch, error)
UnmarshalInch unmarshalls provided string into unit.
func (i *Inch) HasChanged() bool
HasChanged implements pflag.Value interface.
func (i Inch) Inches() Inch
Inches gets the inch value. Implements Length interface.
func (i Inch) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface
func (i Inch) Millimeters() Millimeter
Millimeters converts the inches value to the millimeters.
func (i Inch) Name() string
Name implements pflag.Value interface.
func (i Inch) Points() Point
Points implements Length interface.
func (i *Inch) Set(s string) error
Set implements pflag.Value interface.
func (i Inch) String() string
String implements fmt.Stringer interface.
func (i Inch) Type() string
Type implements pflag.Value interface.
func (i Inch) ValueString() string
ValueString implements pflag.Value interface.
func (i Inch) ValueType() string
ValueType implements pflag.Value interface.
Length is it the default dimension unit.
type Length interface { Millimeters() Millimeter Inches() Inch Points() Point String() string }
func UnmarshalLength(length string) (Length, error)
UnmarshalLength unmarshalls string value into Length.
LengthFlag is a pflag wrapper for the Length value.
type LengthFlag struct { Length Length }
func (u *LengthFlag) Set(s string) error
Set sets the unit value. Implements pflag.Value interface.
func (u *LengthFlag) String() string
String gets the string value for given flag.
func (u *LengthFlag) Type() string
Type implements pflag.Value interface.
Millimeter is the dimension unit that defines a millimeter.
type Millimeter float64
func (m Millimeter) Inches() Inch
Inches gets the inches equivalent from provided millimeter value.
func (m Millimeter) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface
func (m Millimeter) Millimeters() Millimeter
Millimeters gets the float64 millimeter value.
func (m Millimeter) Points() Point
Points implements Length interface.
func (m Millimeter) String() string
String implements fmt.Stringer interface.
Orientation is the page orientation type wrapper.
type Orientation bool
func (o *Orientation) Set(s string) error
Set implements flag.Value interface.
func (o Orientation) String() string
String implements fmt.Stringer interface.
func (o Orientation) Type() string
Type implements pflag.Value interface.
PageSize is the enum used for defining the page size.
type PageSize int
Defines enums used by the ISO 216 page sizes.
const ( Undefined PageSize = iota A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 B10 Letter )
func PageSizeString(s string) (PageSize, error)
PageSizeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func PageSizeValues() []PageSize
PageSizeValues returns all values of the enum
func UnmarshalPageSize(pageSize string) (PageSize, error)
UnmarshalPageSize unmarshals the page size from the string.
func (p PageSize) Dimensions() (width, height Millimeter)
Dimensions gets the dimensions of the given page size. If provided page size is not valid than the function returns 0 values.
func (i PageSize) IsAPageSize() bool
IsAPageSize returns "true" if the value is listed in the enum definition. "false" otherwise
func (i PageSize) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for PageSize
func (i PageSize) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface for PageSize
func (p *PageSize) Set(s string) error
Set implements pflag.Value interface.
func (i PageSize) String() string
func (p PageSize) Type() string
Type implements pflag.Value interface.
func (i *PageSize) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for PageSize
func (i *PageSize) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface for PageSize
Point is a unit of Length commonly used to measure the height of fonts.
type Point float64
func (i *Point) HasChanged() bool
HasChanged implements viper.FlagValue interface.
func (i Point) Inches() Inch
Inches gets the inch value. Implements Length interface.
func (i Point) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface.
func (i Point) Millimeters() Millimeter
Millimeters converts the inches value to the millimeters.
func (i Point) Name() string
Name implements viper.FlagValue interface.
func (i Point) Points() Point
Points implements Length interface.
func (i *Point) Set(s string) error
Set implements flag.Value interface.
func (i Point) String() string
String implements fmt.Stringer interface.
func (i Point) Type() string
Type implements pflag.Value interface.
func (i Point) ValueString() string
ValueString implements viper.FlagValue interface.
func (i Point) ValueType() string
ValueType implements viper.FlagValue interface.