Documentation
¶
Index ¶
- type ElemBr
- func (b *ElemBr) Add(child PDFNode) error
- func (b *ElemBr) AddLine(child PDFNode) error
- func (b *ElemBr) Attribute(name string) (string, bool)
- func (b *ElemBr) ElementAttributes() []PDFNodeAttribute
- func (b *ElemBr) ElementChildLineBreaks() []bool
- func (b *ElemBr) ElementChildren() []PDFNode
- func (b *ElemBr) ElementStyle() *PDFTextStyle
- func (e *ElemBr) ElementType() string
- func (b *ElemBr) SetAttribute(name, value string) PDFElementNode
- type ElemCol
- func (b *ElemCol) Add(child PDFNode) error
- func (b *ElemCol) AddLine(child PDFNode) error
- func (b *ElemCol) Attribute(name string) (string, bool)
- func (b *ElemCol) ElementAttributes() []PDFNodeAttribute
- func (b *ElemCol) ElementChildLineBreaks() []bool
- func (b *ElemCol) ElementChildren() []PDFNode
- func (b *ElemCol) ElementStyle() *PDFTextStyle
- func (e *ElemCol) ElementType() string
- func (b *ElemCol) SetAttribute(name, value string) PDFElementNode
- type ElemColgroup
- func (b *ElemColgroup) Add(child PDFNode) error
- func (b *ElemColgroup) AddLine(child PDFNode) error
- func (b *ElemColgroup) Attribute(name string) (string, bool)
- func (b *ElemColgroup) ElementAttributes() []PDFNodeAttribute
- func (b *ElemColgroup) ElementChildLineBreaks() []bool
- func (b *ElemColgroup) ElementChildren() []PDFNode
- func (b *ElemColgroup) ElementStyle() *PDFTextStyle
- func (e *ElemColgroup) ElementType() string
- func (b *ElemColgroup) SetAttribute(name, value string) PDFElementNode
- type ElemCreateTemplate
- func (b *ElemCreateTemplate) Add(child PDFNode) error
- func (b *ElemCreateTemplate) AddLine(child PDFNode) error
- func (b *ElemCreateTemplate) Attribute(name string) (string, bool)
- func (b *ElemCreateTemplate) ElementAttributes() []PDFNodeAttribute
- func (b *ElemCreateTemplate) ElementChildLineBreaks() []bool
- func (b *ElemCreateTemplate) ElementChildren() []PDFNode
- func (b *ElemCreateTemplate) ElementStyle() *PDFTextStyle
- func (e *ElemCreateTemplate) ElementType() string
- func (b *ElemCreateTemplate) SetAttribute(name, value string) PDFElementNode
- type ElemCurrencyValue
- func (b *ElemCurrencyValue) Add(child PDFNode) error
- func (b *ElemCurrencyValue) AddLine(child PDFNode) error
- func (b *ElemCurrencyValue) Attribute(name string) (string, bool)
- func (b *ElemCurrencyValue) ElementAttributes() []PDFNodeAttribute
- func (b *ElemCurrencyValue) ElementChildLineBreaks() []bool
- func (b *ElemCurrencyValue) ElementChildren() []PDFNode
- func (b *ElemCurrencyValue) ElementStyle() *PDFTextStyle
- func (e *ElemCurrencyValue) ElementType() string
- func (e *ElemCurrencyValue) Format(formatter ValueFormatter) string
- func (b *ElemCurrencyValue) SetAttribute(name, value string) PDFElementNode
- type ElemDateValue
- func (b *ElemDateValue) Add(child PDFNode) error
- func (b *ElemDateValue) AddLine(child PDFNode) error
- func (b *ElemDateValue) Attribute(name string) (string, bool)
- func (b *ElemDateValue) ElementAttributes() []PDFNodeAttribute
- func (b *ElemDateValue) ElementChildLineBreaks() []bool
- func (b *ElemDateValue) ElementChildren() []PDFNode
- func (b *ElemDateValue) ElementStyle() *PDFTextStyle
- func (e *ElemDateValue) ElementType() string
- func (e *ElemDateValue) Format(formatter ValueFormatter) string
- func (b *ElemDateValue) SetAttribute(name, value string) PDFElementNode
- type ElemDiv
- func (b *ElemDiv) Add(child PDFNode) error
- func (b *ElemDiv) AddLine(child PDFNode) error
- func (b *ElemDiv) Attribute(name string) (string, bool)
- func (b *ElemDiv) ElementAttributes() []PDFNodeAttribute
- func (b *ElemDiv) ElementChildLineBreaks() []bool
- func (b *ElemDiv) ElementChildren() []PDFNode
- func (b *ElemDiv) ElementStyle() *PDFTextStyle
- func (e *ElemDiv) ElementType() string
- func (b *ElemDiv) SetAttribute(name, value string) PDFElementNode
- type ElemDurationValue
- func (b *ElemDurationValue) Add(child PDFNode) error
- func (b *ElemDurationValue) AddLine(child PDFNode) error
- func (b *ElemDurationValue) Attribute(name string) (string, bool)
- func (b *ElemDurationValue) ElementAttributes() []PDFNodeAttribute
- func (b *ElemDurationValue) ElementChildLineBreaks() []bool
- func (b *ElemDurationValue) ElementChildren() []PDFNode
- func (b *ElemDurationValue) ElementStyle() *PDFTextStyle
- func (e *ElemDurationValue) ElementType() string
- func (e *ElemDurationValue) Format(formatter ValueFormatter) string
- func (b *ElemDurationValue) SetAttribute(name, value string) PDFElementNode
- type ElemH1
- func (b *ElemH1) Add(child PDFNode) error
- func (b *ElemH1) AddLine(child PDFNode) error
- func (b *ElemH1) Attribute(name string) (string, bool)
- func (b *ElemH1) ElementAttributes() []PDFNodeAttribute
- func (b *ElemH1) ElementChildLineBreaks() []bool
- func (b *ElemH1) ElementChildren() []PDFNode
- func (b *ElemH1) ElementStyle() *PDFTextStyle
- func (e *ElemH1) ElementType() string
- func (b *ElemH1) SetAttribute(name, value string) PDFElementNode
- type ElemH2
- func (b *ElemH2) Add(child PDFNode) error
- func (b *ElemH2) AddLine(child PDFNode) error
- func (b *ElemH2) Attribute(name string) (string, bool)
- func (b *ElemH2) ElementAttributes() []PDFNodeAttribute
- func (b *ElemH2) ElementChildLineBreaks() []bool
- func (b *ElemH2) ElementChildren() []PDFNode
- func (b *ElemH2) ElementStyle() *PDFTextStyle
- func (e *ElemH2) ElementType() string
- func (b *ElemH2) SetAttribute(name, value string) PDFElementNode
- type ElemH3
- func (b *ElemH3) Add(child PDFNode) error
- func (b *ElemH3) AddLine(child PDFNode) error
- func (b *ElemH3) Attribute(name string) (string, bool)
- func (b *ElemH3) ElementAttributes() []PDFNodeAttribute
- func (b *ElemH3) ElementChildLineBreaks() []bool
- func (b *ElemH3) ElementChildren() []PDFNode
- func (b *ElemH3) ElementStyle() *PDFTextStyle
- func (e *ElemH3) ElementType() string
- func (b *ElemH3) SetAttribute(name, value string) PDFElementNode
- type ElemImg
- func (b *ElemImg) Add(child PDFNode) error
- func (b *ElemImg) AddLine(child PDFNode) error
- func (b *ElemImg) Attribute(name string) (string, bool)
- func (b *ElemImg) ElementAttributes() []PDFNodeAttribute
- func (b *ElemImg) ElementChildLineBreaks() []bool
- func (b *ElemImg) ElementChildren() []PDFNode
- func (b *ElemImg) ElementStyle() *PDFTextStyle
- func (e *ElemImg) ElementType() string
- func (b *ElemImg) SetAttribute(name, value string) PDFElementNode
- type ElemLi
- func (b *ElemLi) Add(child PDFNode) error
- func (b *ElemLi) AddLine(child PDFNode) error
- func (b *ElemLi) Attribute(name string) (string, bool)
- func (b *ElemLi) ElementAttributes() []PDFNodeAttribute
- func (b *ElemLi) ElementChildLineBreaks() []bool
- func (b *ElemLi) ElementChildren() []PDFNode
- func (b *ElemLi) ElementStyle() *PDFTextStyle
- func (e *ElemLi) ElementType() string
- func (b *ElemLi) SetAttribute(name, value string) PDFElementNode
- type ElemManDaysValue
- func (b *ElemManDaysValue) Add(child PDFNode) error
- func (b *ElemManDaysValue) AddLine(child PDFNode) error
- func (b *ElemManDaysValue) Attribute(name string) (string, bool)
- func (b *ElemManDaysValue) ElementAttributes() []PDFNodeAttribute
- func (b *ElemManDaysValue) ElementChildLineBreaks() []bool
- func (b *ElemManDaysValue) ElementChildren() []PDFNode
- func (b *ElemManDaysValue) ElementStyle() *PDFTextStyle
- func (e *ElemManDaysValue) ElementType() string
- func (e *ElemManDaysValue) Format(formatter ValueFormatter) string
- func (b *ElemManDaysValue) SetAttribute(name, value string) PDFElementNode
- type ElemOl
- func (b *ElemOl) Add(child PDFNode) error
- func (b *ElemOl) AddLine(child PDFNode) error
- func (b *ElemOl) Attribute(name string) (string, bool)
- func (b *ElemOl) ElementAttributes() []PDFNodeAttribute
- func (b *ElemOl) ElementChildLineBreaks() []bool
- func (b *ElemOl) ElementChildren() []PDFNode
- func (b *ElemOl) ElementStyle() *PDFTextStyle
- func (e *ElemOl) ElementType() string
- func (b *ElemOl) SetAttribute(name, value string) PDFElementNode
- type ElemSpan
- func (b *ElemSpan) Add(child PDFNode) error
- func (b *ElemSpan) AddLine(child PDFNode) error
- func (b *ElemSpan) Attribute(name string) (string, bool)
- func (b *ElemSpan) ElementAttributes() []PDFNodeAttribute
- func (b *ElemSpan) ElementChildLineBreaks() []bool
- func (b *ElemSpan) ElementChildren() []PDFNode
- func (b *ElemSpan) ElementStyle() *PDFTextStyle
- func (e *ElemSpan) ElementType() string
- func (b *ElemSpan) SetAttribute(name, value string) PDFElementNode
- type ElemTable
- func (b *ElemTable) Add(child PDFNode) error
- func (b *ElemTable) AddLine(child PDFNode) error
- func (b *ElemTable) Attribute(name string) (string, bool)
- func (b *ElemTable) ElementAttributes() []PDFNodeAttribute
- func (b *ElemTable) ElementChildLineBreaks() []bool
- func (b *ElemTable) ElementChildren() []PDFNode
- func (b *ElemTable) ElementStyle() *PDFTextStyle
- func (e *ElemTable) ElementType() string
- func (b *ElemTable) SetAttribute(name, value string) PDFElementNode
- type ElemTbody
- func (b *ElemTbody) Add(child PDFNode) error
- func (b *ElemTbody) AddLine(child PDFNode) error
- func (b *ElemTbody) Attribute(name string) (string, bool)
- func (b *ElemTbody) ElementAttributes() []PDFNodeAttribute
- func (b *ElemTbody) ElementChildLineBreaks() []bool
- func (b *ElemTbody) ElementChildren() []PDFNode
- func (b *ElemTbody) ElementStyle() *PDFTextStyle
- func (e *ElemTbody) ElementType() string
- func (b *ElemTbody) SetAttribute(name, value string) PDFElementNode
- type ElemTd
- func (b *ElemTd) Add(child PDFNode) error
- func (b *ElemTd) AddLine(child PDFNode) error
- func (b *ElemTd) Attribute(name string) (string, bool)
- func (b *ElemTd) ElementAttributes() []PDFNodeAttribute
- func (b *ElemTd) ElementChildLineBreaks() []bool
- func (b *ElemTd) ElementChildren() []PDFNode
- func (b *ElemTd) ElementStyle() *PDFTextStyle
- func (e *ElemTd) ElementType() string
- func (b *ElemTd) SetAttribute(name, value string) PDFElementNode
- type ElemTh
- func (b *ElemTh) Add(child PDFNode) error
- func (b *ElemTh) AddLine(child PDFNode) error
- func (b *ElemTh) Attribute(name string) (string, bool)
- func (b *ElemTh) ElementAttributes() []PDFNodeAttribute
- func (b *ElemTh) ElementChildLineBreaks() []bool
- func (b *ElemTh) ElementChildren() []PDFNode
- func (b *ElemTh) ElementStyle() *PDFTextStyle
- func (e *ElemTh) ElementType() string
- func (b *ElemTh) SetAttribute(name, value string) PDFElementNode
- type ElemThead
- func (b *ElemThead) Add(child PDFNode) error
- func (b *ElemThead) AddLine(child PDFNode) error
- func (b *ElemThead) Attribute(name string) (string, bool)
- func (b *ElemThead) ElementAttributes() []PDFNodeAttribute
- func (b *ElemThead) ElementChildLineBreaks() []bool
- func (b *ElemThead) ElementChildren() []PDFNode
- func (b *ElemThead) ElementStyle() *PDFTextStyle
- func (e *ElemThead) ElementType() string
- func (b *ElemThead) SetAttribute(name, value string) PDFElementNode
- type ElemTr
- func (b *ElemTr) Add(child PDFNode) error
- func (b *ElemTr) AddLine(child PDFNode) error
- func (b *ElemTr) Attribute(name string) (string, bool)
- func (b *ElemTr) ElementAttributes() []PDFNodeAttribute
- func (b *ElemTr) ElementChildLineBreaks() []bool
- func (b *ElemTr) ElementChildren() []PDFNode
- func (b *ElemTr) ElementStyle() *PDFTextStyle
- func (e *ElemTr) ElementType() string
- func (b *ElemTr) SetAttribute(name, value string) PDFElementNode
- type ElemUl
- func (b *ElemUl) Add(child PDFNode) error
- func (b *ElemUl) AddLine(child PDFNode) error
- func (b *ElemUl) Attribute(name string) (string, bool)
- func (b *ElemUl) ElementAttributes() []PDFNodeAttribute
- func (b *ElemUl) ElementChildLineBreaks() []bool
- func (b *ElemUl) ElementChildren() []PDFNode
- func (b *ElemUl) ElementStyle() *PDFTextStyle
- func (e *ElemUl) ElementType() string
- func (b *ElemUl) SetAttribute(name, value string) PDFElementNode
- type ElemUseTemplate
- func (b *ElemUseTemplate) Add(child PDFNode) error
- func (b *ElemUseTemplate) AddLine(child PDFNode) error
- func (b *ElemUseTemplate) Attribute(name string) (string, bool)
- func (b *ElemUseTemplate) ElementAttributes() []PDFNodeAttribute
- func (b *ElemUseTemplate) ElementChildLineBreaks() []bool
- func (b *ElemUseTemplate) ElementChildren() []PDFNode
- func (b *ElemUseTemplate) ElementStyle() *PDFTextStyle
- func (e *ElemUseTemplate) ElementType() string
- func (b *ElemUseTemplate) SetAttribute(name, value string) PDFElementNode
- type PDFDocumentNode
- type PDFElementNode
- func ParseHTMLDocFlow(htmlStr, cssStyle string) ([]PDFElementNode, error)
- func ParseHTMLDocFlowPrepared(htmlString string, stylesheet *tmpl.PreparedStylesheet) ([]PDFElementNode, error)
- func ParseHTMLDocFlowPreparedWithOptions(htmlString string, stylesheet *tmpl.PreparedStylesheet, options ParseOptions) ([]PDFElementNode, error)
- type PDFNode
- type PDFNodeAttribute
- type PDFText
- type PDFTextBox
- type PDFTextNode
- type PDFTextStyle
- type ParseOptions
- type StyleVariant
- type TextAlign
- type TextFitMode
- type Translator
- type ValueFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ElemBr ¶
type ElemBr struct {
// contains filtered or unexported fields
}
func (*ElemBr) ElementAttributes ¶
func (b *ElemBr) ElementAttributes() []PDFNodeAttribute
func (*ElemBr) ElementChildLineBreaks ¶
func (b *ElemBr) ElementChildLineBreaks() []bool
func (*ElemBr) ElementChildren ¶
func (b *ElemBr) ElementChildren() []PDFNode
func (*ElemBr) ElementStyle ¶
func (b *ElemBr) ElementStyle() *PDFTextStyle
func (*ElemBr) ElementType ¶
func (*ElemBr) SetAttribute ¶
func (b *ElemBr) SetAttribute(name, value string) PDFElementNode
type ElemCol ¶
type ElemCol struct {
// contains filtered or unexported fields
}
func NewElemCol ¶
func NewElemCol() *ElemCol
func (*ElemCol) ElementAttributes ¶
func (b *ElemCol) ElementAttributes() []PDFNodeAttribute
func (*ElemCol) ElementChildLineBreaks ¶
func (b *ElemCol) ElementChildLineBreaks() []bool
func (*ElemCol) ElementChildren ¶
func (b *ElemCol) ElementChildren() []PDFNode
func (*ElemCol) ElementStyle ¶
func (b *ElemCol) ElementStyle() *PDFTextStyle
func (*ElemCol) ElementType ¶
func (*ElemCol) SetAttribute ¶
func (b *ElemCol) SetAttribute(name, value string) PDFElementNode
type ElemColgroup ¶
type ElemColgroup struct {
// contains filtered or unexported fields
}
func NewElemColgroup ¶
func NewElemColgroup() *ElemColgroup
func (*ElemColgroup) ElementAttributes ¶
func (b *ElemColgroup) ElementAttributes() []PDFNodeAttribute
func (*ElemColgroup) ElementChildLineBreaks ¶
func (b *ElemColgroup) ElementChildLineBreaks() []bool
func (*ElemColgroup) ElementChildren ¶
func (b *ElemColgroup) ElementChildren() []PDFNode
func (*ElemColgroup) ElementStyle ¶
func (b *ElemColgroup) ElementStyle() *PDFTextStyle
func (*ElemColgroup) ElementType ¶
func (e *ElemColgroup) ElementType() string
func (*ElemColgroup) SetAttribute ¶
func (b *ElemColgroup) SetAttribute(name, value string) PDFElementNode
type ElemCreateTemplate ¶
type ElemCreateTemplate struct {
// contains filtered or unexported fields
}
func NewElemCreateTemplate ¶
func NewElemCreateTemplate() *ElemCreateTemplate
func (*ElemCreateTemplate) ElementAttributes ¶
func (b *ElemCreateTemplate) ElementAttributes() []PDFNodeAttribute
func (*ElemCreateTemplate) ElementChildLineBreaks ¶
func (b *ElemCreateTemplate) ElementChildLineBreaks() []bool
func (*ElemCreateTemplate) ElementChildren ¶
func (b *ElemCreateTemplate) ElementChildren() []PDFNode
func (*ElemCreateTemplate) ElementStyle ¶
func (b *ElemCreateTemplate) ElementStyle() *PDFTextStyle
func (*ElemCreateTemplate) ElementType ¶
func (e *ElemCreateTemplate) ElementType() string
func (*ElemCreateTemplate) SetAttribute ¶
func (b *ElemCreateTemplate) SetAttribute(name, value string) PDFElementNode
type ElemCurrencyValue ¶
type ElemCurrencyValue struct {
Value float64
// contains filtered or unexported fields
}
ElemCurrencyValue formats a float64 as a locale-aware currency string.
func NewElemCurrencyValue ¶
func NewElemCurrencyValue(value float64) *ElemCurrencyValue
func (*ElemCurrencyValue) ElementAttributes ¶
func (b *ElemCurrencyValue) ElementAttributes() []PDFNodeAttribute
func (*ElemCurrencyValue) ElementChildLineBreaks ¶
func (b *ElemCurrencyValue) ElementChildLineBreaks() []bool
func (*ElemCurrencyValue) ElementChildren ¶
func (b *ElemCurrencyValue) ElementChildren() []PDFNode
func (*ElemCurrencyValue) ElementStyle ¶
func (b *ElemCurrencyValue) ElementStyle() *PDFTextStyle
func (*ElemCurrencyValue) ElementType ¶
func (e *ElemCurrencyValue) ElementType() string
func (*ElemCurrencyValue) Format ¶
func (e *ElemCurrencyValue) Format(formatter ValueFormatter) string
Format returns the locale-formatted currency string.
func (*ElemCurrencyValue) SetAttribute ¶
func (b *ElemCurrencyValue) SetAttribute(name, value string) PDFElementNode
type ElemDateValue ¶
type ElemDateValue struct {
Value string
// contains filtered or unexported fields
}
ElemDateValue formats an ISO-8601 date string ("2006-01-02"). Attribute "long" = "true" selects the long date format.
func NewElemDateValue ¶
func NewElemDateValue(dateStr string) *ElemDateValue
func (*ElemDateValue) ElementAttributes ¶
func (b *ElemDateValue) ElementAttributes() []PDFNodeAttribute
func (*ElemDateValue) ElementChildLineBreaks ¶
func (b *ElemDateValue) ElementChildLineBreaks() []bool
func (*ElemDateValue) ElementChildren ¶
func (b *ElemDateValue) ElementChildren() []PDFNode
func (*ElemDateValue) ElementStyle ¶
func (b *ElemDateValue) ElementStyle() *PDFTextStyle
func (*ElemDateValue) ElementType ¶
func (e *ElemDateValue) ElementType() string
func (*ElemDateValue) Format ¶
func (e *ElemDateValue) Format(formatter ValueFormatter) string
Format returns the formatted date, using long format when requested.
func (*ElemDateValue) SetAttribute ¶
func (b *ElemDateValue) SetAttribute(name, value string) PDFElementNode
type ElemDiv ¶
type ElemDiv struct {
// contains filtered or unexported fields
}
func NewElemDiv ¶
func NewElemDiv() *ElemDiv
func ParseHTMLSectionElem ¶
ParseHTMLSectionElem parses an HTML fragment containing a <div id="intro"> element with <span>, <div> and <br> children and maps it to an ElemDiv. cssStyle is applied before parsing (may be empty).
func (*ElemDiv) ElementAttributes ¶
func (b *ElemDiv) ElementAttributes() []PDFNodeAttribute
func (*ElemDiv) ElementChildLineBreaks ¶
func (b *ElemDiv) ElementChildLineBreaks() []bool
func (*ElemDiv) ElementChildren ¶
func (b *ElemDiv) ElementChildren() []PDFNode
func (*ElemDiv) ElementStyle ¶
func (b *ElemDiv) ElementStyle() *PDFTextStyle
func (*ElemDiv) ElementType ¶
func (*ElemDiv) SetAttribute ¶
func (b *ElemDiv) SetAttribute(name, value string) PDFElementNode
type ElemDurationValue ¶
type ElemDurationValue struct {
Value float64
// contains filtered or unexported fields
}
ElemDurationValue formats hours as "H:MM" duration text.
func NewElemDurationValue ¶
func NewElemDurationValue(hours float64) *ElemDurationValue
func (*ElemDurationValue) ElementAttributes ¶
func (b *ElemDurationValue) ElementAttributes() []PDFNodeAttribute
func (*ElemDurationValue) ElementChildLineBreaks ¶
func (b *ElemDurationValue) ElementChildLineBreaks() []bool
func (*ElemDurationValue) ElementChildren ¶
func (b *ElemDurationValue) ElementChildren() []PDFNode
func (*ElemDurationValue) ElementStyle ¶
func (b *ElemDurationValue) ElementStyle() *PDFTextStyle
func (*ElemDurationValue) ElementType ¶
func (e *ElemDurationValue) ElementType() string
func (*ElemDurationValue) Format ¶
func (e *ElemDurationValue) Format(formatter ValueFormatter) string
Format returns the duration as "H:MM".
func (*ElemDurationValue) SetAttribute ¶
func (b *ElemDurationValue) SetAttribute(name, value string) PDFElementNode
type ElemH1 ¶
type ElemH1 struct {
// contains filtered or unexported fields
}
func (*ElemH1) ElementAttributes ¶
func (b *ElemH1) ElementAttributes() []PDFNodeAttribute
func (*ElemH1) ElementChildLineBreaks ¶
func (b *ElemH1) ElementChildLineBreaks() []bool
func (*ElemH1) ElementChildren ¶
func (b *ElemH1) ElementChildren() []PDFNode
func (*ElemH1) ElementStyle ¶
func (b *ElemH1) ElementStyle() *PDFTextStyle
func (*ElemH1) ElementType ¶
func (*ElemH1) SetAttribute ¶
func (b *ElemH1) SetAttribute(name, value string) PDFElementNode
type ElemH2 ¶
type ElemH2 struct {
// contains filtered or unexported fields
}
func (*ElemH2) ElementAttributes ¶
func (b *ElemH2) ElementAttributes() []PDFNodeAttribute
func (*ElemH2) ElementChildLineBreaks ¶
func (b *ElemH2) ElementChildLineBreaks() []bool
func (*ElemH2) ElementChildren ¶
func (b *ElemH2) ElementChildren() []PDFNode
func (*ElemH2) ElementStyle ¶
func (b *ElemH2) ElementStyle() *PDFTextStyle
func (*ElemH2) ElementType ¶
func (*ElemH2) SetAttribute ¶
func (b *ElemH2) SetAttribute(name, value string) PDFElementNode
type ElemH3 ¶
type ElemH3 struct {
// contains filtered or unexported fields
}
func (*ElemH3) ElementAttributes ¶
func (b *ElemH3) ElementAttributes() []PDFNodeAttribute
func (*ElemH3) ElementChildLineBreaks ¶
func (b *ElemH3) ElementChildLineBreaks() []bool
func (*ElemH3) ElementChildren ¶
func (b *ElemH3) ElementChildren() []PDFNode
func (*ElemH3) ElementStyle ¶
func (b *ElemH3) ElementStyle() *PDFTextStyle
func (*ElemH3) ElementType ¶
func (*ElemH3) SetAttribute ¶
func (b *ElemH3) SetAttribute(name, value string) PDFElementNode
type ElemImg ¶
type ElemImg struct {
// contains filtered or unexported fields
}
func NewElemImg ¶
func NewElemImg() *ElemImg
func (*ElemImg) ElementAttributes ¶
func (b *ElemImg) ElementAttributes() []PDFNodeAttribute
func (*ElemImg) ElementChildLineBreaks ¶
func (b *ElemImg) ElementChildLineBreaks() []bool
func (*ElemImg) ElementChildren ¶
func (b *ElemImg) ElementChildren() []PDFNode
func (*ElemImg) ElementStyle ¶
func (b *ElemImg) ElementStyle() *PDFTextStyle
func (*ElemImg) ElementType ¶
func (*ElemImg) SetAttribute ¶
func (b *ElemImg) SetAttribute(name, value string) PDFElementNode
type ElemLi ¶
type ElemLi struct {
// contains filtered or unexported fields
}
func (*ElemLi) ElementAttributes ¶
func (b *ElemLi) ElementAttributes() []PDFNodeAttribute
func (*ElemLi) ElementChildLineBreaks ¶
func (b *ElemLi) ElementChildLineBreaks() []bool
func (*ElemLi) ElementChildren ¶
func (b *ElemLi) ElementChildren() []PDFNode
func (*ElemLi) ElementStyle ¶
func (b *ElemLi) ElementStyle() *PDFTextStyle
func (*ElemLi) ElementType ¶
func (*ElemLi) SetAttribute ¶
func (b *ElemLi) SetAttribute(name, value string) PDFElementNode
type ElemManDaysValue ¶
type ElemManDaysValue struct {
Value float64
// contains filtered or unexported fields
}
ElemManDaysValue formats a man-days quantity with locale-aware decimal formatting and an optional " PT" (Personentage) unit suffix. Attribute "unit" = "true" appends the unit suffix.
func NewElemManDaysValue ¶
func NewElemManDaysValue(days float64) *ElemManDaysValue
func (*ElemManDaysValue) ElementAttributes ¶
func (b *ElemManDaysValue) ElementAttributes() []PDFNodeAttribute
func (*ElemManDaysValue) ElementChildLineBreaks ¶
func (b *ElemManDaysValue) ElementChildLineBreaks() []bool
func (*ElemManDaysValue) ElementChildren ¶
func (b *ElemManDaysValue) ElementChildren() []PDFNode
func (*ElemManDaysValue) ElementStyle ¶
func (b *ElemManDaysValue) ElementStyle() *PDFTextStyle
func (*ElemManDaysValue) ElementType ¶
func (e *ElemManDaysValue) ElementType() string
func (*ElemManDaysValue) Format ¶
func (e *ElemManDaysValue) Format(formatter ValueFormatter) string
Format returns man-days with an optional " PT" suffix.
func (*ElemManDaysValue) SetAttribute ¶
func (b *ElemManDaysValue) SetAttribute(name, value string) PDFElementNode
type ElemOl ¶
type ElemOl struct {
// contains filtered or unexported fields
}
func (*ElemOl) ElementAttributes ¶
func (b *ElemOl) ElementAttributes() []PDFNodeAttribute
func (*ElemOl) ElementChildLineBreaks ¶
func (b *ElemOl) ElementChildLineBreaks() []bool
func (*ElemOl) ElementChildren ¶
func (b *ElemOl) ElementChildren() []PDFNode
func (*ElemOl) ElementStyle ¶
func (b *ElemOl) ElementStyle() *PDFTextStyle
func (*ElemOl) ElementType ¶
func (*ElemOl) SetAttribute ¶
func (b *ElemOl) SetAttribute(name, value string) PDFElementNode
type ElemSpan ¶
type ElemSpan struct {
// contains filtered or unexported fields
}
func NewElemSpan ¶
func NewElemSpan() *ElemSpan
func (*ElemSpan) ElementAttributes ¶
func (b *ElemSpan) ElementAttributes() []PDFNodeAttribute
func (*ElemSpan) ElementChildLineBreaks ¶
func (b *ElemSpan) ElementChildLineBreaks() []bool
func (*ElemSpan) ElementChildren ¶
func (b *ElemSpan) ElementChildren() []PDFNode
func (*ElemSpan) ElementStyle ¶
func (b *ElemSpan) ElementStyle() *PDFTextStyle
func (*ElemSpan) ElementType ¶
func (*ElemSpan) SetAttribute ¶
func (b *ElemSpan) SetAttribute(name, value string) PDFElementNode
type ElemTable ¶
type ElemTable struct {
// contains filtered or unexported fields
}
func NewElemTable ¶
func NewElemTable() *ElemTable
func ParseHTMLTableElem ¶
ParseHTMLTableElem parses an HTML fragment containing a <table> element and maps it to the same ElemTable / Elem* node tree used by the PDF rendering pipeline. cssStyle is applied before parsing (may be empty).
Mapping rules:
<table> → ElemTable (all attributes forwarded)
<colgroup> → ElemColgroup
<col> → ElemCol (width attribute forwarded)
<thead> → ElemThead
<tbody> → ElemTbody
<tr> → ElemTr (fill, stroke, height forwarded)
<td> → ElemTd (align, colspan forwarded)
<th> → ElemTh (align, colspan forwarded)
<span> → PDFTextNode (font-style/face/size/color/align
become PDFTextStyle fields)
<currency-value> → ElemCurrencyValue ("v" attr → Value float64)
<date-value> → ElemDateValue ("value" attr → Value string;
"long" attr forwarded)
<duration-value> → ElemDurationValue ("v" attr → Value float64)
<man-days-value> → ElemManDaysValue ("v" attr → Value float64;
"unit" attr forwarded)
Attribute name normalisation (HTML kebab-case → Elem* camelCase):
row-height-min → rowHeightMin
Inside <td>, the first non-empty child is added inline (Add); each subsequent child is added with a preceding line break (AddLine), matching the main-text / sub-text rendering idiom.
func (*ElemTable) ElementAttributes ¶
func (b *ElemTable) ElementAttributes() []PDFNodeAttribute
func (*ElemTable) ElementChildLineBreaks ¶
func (b *ElemTable) ElementChildLineBreaks() []bool
func (*ElemTable) ElementChildren ¶
func (b *ElemTable) ElementChildren() []PDFNode
func (*ElemTable) ElementStyle ¶
func (b *ElemTable) ElementStyle() *PDFTextStyle
func (*ElemTable) ElementType ¶
func (*ElemTable) SetAttribute ¶
func (b *ElemTable) SetAttribute(name, value string) PDFElementNode
type ElemTbody ¶
type ElemTbody struct {
// contains filtered or unexported fields
}
func NewElemTbody ¶
func NewElemTbody() *ElemTbody
func (*ElemTbody) ElementAttributes ¶
func (b *ElemTbody) ElementAttributes() []PDFNodeAttribute
func (*ElemTbody) ElementChildLineBreaks ¶
func (b *ElemTbody) ElementChildLineBreaks() []bool
func (*ElemTbody) ElementChildren ¶
func (b *ElemTbody) ElementChildren() []PDFNode
func (*ElemTbody) ElementStyle ¶
func (b *ElemTbody) ElementStyle() *PDFTextStyle
func (*ElemTbody) ElementType ¶
func (*ElemTbody) SetAttribute ¶
func (b *ElemTbody) SetAttribute(name, value string) PDFElementNode
type ElemTd ¶
type ElemTd struct {
// contains filtered or unexported fields
}
func (*ElemTd) ElementAttributes ¶
func (b *ElemTd) ElementAttributes() []PDFNodeAttribute
func (*ElemTd) ElementChildLineBreaks ¶
func (b *ElemTd) ElementChildLineBreaks() []bool
func (*ElemTd) ElementChildren ¶
func (b *ElemTd) ElementChildren() []PDFNode
func (*ElemTd) ElementStyle ¶
func (b *ElemTd) ElementStyle() *PDFTextStyle
func (*ElemTd) ElementType ¶
func (*ElemTd) SetAttribute ¶
func (b *ElemTd) SetAttribute(name, value string) PDFElementNode
type ElemTh ¶
type ElemTh struct {
// contains filtered or unexported fields
}
func (*ElemTh) ElementAttributes ¶
func (b *ElemTh) ElementAttributes() []PDFNodeAttribute
func (*ElemTh) ElementChildLineBreaks ¶
func (b *ElemTh) ElementChildLineBreaks() []bool
func (*ElemTh) ElementChildren ¶
func (b *ElemTh) ElementChildren() []PDFNode
func (*ElemTh) ElementStyle ¶
func (b *ElemTh) ElementStyle() *PDFTextStyle
func (*ElemTh) ElementType ¶
func (*ElemTh) SetAttribute ¶
func (b *ElemTh) SetAttribute(name, value string) PDFElementNode
type ElemThead ¶
type ElemThead struct {
// contains filtered or unexported fields
}
func NewElemThead ¶
func NewElemThead() *ElemThead
func (*ElemThead) ElementAttributes ¶
func (b *ElemThead) ElementAttributes() []PDFNodeAttribute
func (*ElemThead) ElementChildLineBreaks ¶
func (b *ElemThead) ElementChildLineBreaks() []bool
func (*ElemThead) ElementChildren ¶
func (b *ElemThead) ElementChildren() []PDFNode
func (*ElemThead) ElementStyle ¶
func (b *ElemThead) ElementStyle() *PDFTextStyle
func (*ElemThead) ElementType ¶
func (*ElemThead) SetAttribute ¶
func (b *ElemThead) SetAttribute(name, value string) PDFElementNode
type ElemTr ¶
type ElemTr struct {
// contains filtered or unexported fields
}
func (*ElemTr) ElementAttributes ¶
func (b *ElemTr) ElementAttributes() []PDFNodeAttribute
func (*ElemTr) ElementChildLineBreaks ¶
func (b *ElemTr) ElementChildLineBreaks() []bool
func (*ElemTr) ElementChildren ¶
func (b *ElemTr) ElementChildren() []PDFNode
func (*ElemTr) ElementStyle ¶
func (b *ElemTr) ElementStyle() *PDFTextStyle
func (*ElemTr) ElementType ¶
func (*ElemTr) SetAttribute ¶
func (b *ElemTr) SetAttribute(name, value string) PDFElementNode
type ElemUl ¶
type ElemUl struct {
// contains filtered or unexported fields
}
func (*ElemUl) ElementAttributes ¶
func (b *ElemUl) ElementAttributes() []PDFNodeAttribute
func (*ElemUl) ElementChildLineBreaks ¶
func (b *ElemUl) ElementChildLineBreaks() []bool
func (*ElemUl) ElementChildren ¶
func (b *ElemUl) ElementChildren() []PDFNode
func (*ElemUl) ElementStyle ¶
func (b *ElemUl) ElementStyle() *PDFTextStyle
func (*ElemUl) ElementType ¶
func (*ElemUl) SetAttribute ¶
func (b *ElemUl) SetAttribute(name, value string) PDFElementNode
type ElemUseTemplate ¶
type ElemUseTemplate struct {
// contains filtered or unexported fields
}
func NewElemUseTemplate ¶
func NewElemUseTemplate() *ElemUseTemplate
func (*ElemUseTemplate) ElementAttributes ¶
func (b *ElemUseTemplate) ElementAttributes() []PDFNodeAttribute
func (*ElemUseTemplate) ElementChildLineBreaks ¶
func (b *ElemUseTemplate) ElementChildLineBreaks() []bool
func (*ElemUseTemplate) ElementChildren ¶
func (b *ElemUseTemplate) ElementChildren() []PDFNode
func (*ElemUseTemplate) ElementStyle ¶
func (b *ElemUseTemplate) ElementStyle() *PDFTextStyle
func (*ElemUseTemplate) ElementType ¶
func (e *ElemUseTemplate) ElementType() string
func (*ElemUseTemplate) SetAttribute ¶
func (b *ElemUseTemplate) SetAttribute(name, value string) PDFElementNode
type PDFDocumentNode ¶
type PDFDocumentNode struct {
Style *PDFTextStyle
Children []PDFNode
ChildLineBreaks []bool
}
PDFDocumentNode is the root node and may contain element and text nodes.
func (*PDFDocumentNode) Add ¶
func (d *PDFDocumentNode) Add(child PDFNode) *PDFDocumentNode
Add appends a child node inline (no implicit newline).
func (*PDFDocumentNode) AddLine ¶
func (d *PDFDocumentNode) AddLine(child PDFNode) *PDFDocumentNode
AddLine appends a child node and inserts an implicit newline before it.
type PDFElementNode ¶
type PDFElementNode interface {
PDFNode
ElementType() string
ElementStyle() *PDFTextStyle
ElementChildren() []PDFNode
ElementChildLineBreaks() []bool
ElementAttributes() []PDFNodeAttribute
SetAttribute(name, value string) PDFElementNode
Attribute(name string) (string, bool)
Add(child PDFNode) error
AddLine(child PDFNode) error
// contains filtered or unexported methods
}
PDFElementNode is implemented by typed HTML-like container elements.
func ParseHTMLDocFlow ¶
func ParseHTMLDocFlow(htmlStr, cssStyle string) ([]PDFElementNode, error)
ParseHTMLDocFlow parses an HTML fragment into top-level renderable elements in source order. cssStyle is applied before parsing (may be empty). Supported root-level tags are <div>, <footer>, <p>, <table>, <img>, and headings <h1>..<h3>.
func ParseHTMLDocFlowPrepared ¶
func ParseHTMLDocFlowPrepared(htmlString string, stylesheet *tmpl.PreparedStylesheet) ([]PDFElementNode, error)
func ParseHTMLDocFlowPreparedWithOptions ¶
func ParseHTMLDocFlowPreparedWithOptions(htmlString string, stylesheet *tmpl.PreparedStylesheet, options ParseOptions) ([]PDFElementNode, error)
type PDFNode ¶
type PDFNode interface {
// contains filtered or unexported methods
}
PDFNode is implemented by all declarative document/text tree nodes.
type PDFNodeAttribute ¶
PDFNodeAttribute defines an element attribute (name/value).
type PDFText ¶
type PDFText = PDFTextNode
PDFText is kept as a compatibility alias for existing call sites.
type PDFTextBox ¶
type PDFTextBox struct {
X float64
Y float64
Width float64
Height float64
Fit TextFitMode
}
PDFTextBox defines the desired bounding box and fit strategy.
type PDFTextNode ¶
type PDFTextNode struct {
Text string
I18nKey string
I18nVars map[string]string
Style *PDFTextStyle
Children []PDFNode
// ChildLineBreaks stores whether a line break should be inserted before a
// child at the same index in Children.
ChildLineBreaks []bool
}
PDFTextNode is a declarative text node that can contain child text nodes.
func (*PDFTextNode) Add ¶
func (t *PDFTextNode) Add(child PDFNode) *PDFTextNode
Add appends a child node inline (no implicit newline).
func (*PDFTextNode) AddLine ¶
func (t *PDFTextNode) AddLine(child PDFNode) *PDFTextNode
AddLine appends a child node and inserts an implicit newline before it.
type PDFTextStyle ¶
type PDFTextStyle struct {
FontFace string
FontStyle string
FontStyleSet bool
FontSize float64
FontColor string
Align TextAlign
LineHeight float64
BackgroundColor string
BorderColor string
BorderStyle string
BorderWidth float64
}
PDFTextStyle defines text styling and supports inheritance.
func (PDFTextStyle) Merge ¶
func (base PDFTextStyle) Merge(override *PDFTextStyle) PDFTextStyle
Merge returns a style where missing values from override are inherited from base.
type ParseOptions ¶
type StyleVariant ¶
StyleVariant holds the font rendering attributes for a single named style variant (Normal, Small, Title, etc.). It is defined here so that pdflayout can use it without importing the invoice package.
type TextAlign ¶
type TextAlign string
TextAlign controls horizontal text alignment inside a bounding box.
type TextFitMode ¶
type TextFitMode string
TextFitMode controls how text behaves inside a constrained width/height.
const ( TextFitWrap TextFitMode = "wrap" TextFitClip TextFitMode = "clip" )
type Translator ¶
type Translator interface {
T(key string) string
TWithVars(key string, vars map[string]string) string
}
Translator resolves i18n keys to their translated strings. Implemented by *invoice.I18n; defined here to avoid an import cycle.
type ValueFormatter ¶
type ValueFormatter interface {
FormatCurrency(value float64) string
FormatDate(dateStr string, long bool) string
FormatDuration(hours float64) string
FormatFloat(value float64, decimals int) string
}
ValueFormatter formats typed domain values for rendering. Implemented by *invoice.Formatter; defined here to avoid an import cycle.