Documentation ¶
Index ¶
- type CSSBuilder
- func (cb *CSSBuilder) AddCSS(css string) error
- func (cb *CSSBuilder) BeforeShipout() error
- func (cb *CSSBuilder) CreateVlist(te *frontend.Text, wd bag.ScaledPoint) (*node.VList, error)
- func (cb *CSSBuilder) HTMLToText(html string) (*frontend.Text, error)
- func (cb *CSSBuilder) InitPage() error
- func (cb *CSSBuilder) NewPage() error
- func (cb *CSSBuilder) OutputAt(text *frontend.Text, x, y, width bag.ScaledPoint) error
- func (cb *CSSBuilder) OutputPage(html string) error
- func (cb *CSSBuilder) PageSize() (PageDimensions, error)
- func (cb *CSSBuilder) ParseCSSString(css string) error
- func (cb *CSSBuilder) ParseHTMLFromNode(input *html.Node) (*frontend.Text, error)
- func (cb *CSSBuilder) ReadCSSFile(filename string) error
- func (cb *CSSBuilder) ShowCSS() string
- type PageDimensions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CSSBuilder ¶
type CSSBuilder struct {
// contains filtered or unexported fields
}
CSSBuilder handles HTML chunks and CSS instructions.
func New ¶
func New(fd *frontend.Document, c *csshtml.CSS) *CSSBuilder
New creates an instance of the CSSBuilder.
func (*CSSBuilder) AddCSS ¶
func (cb *CSSBuilder) AddCSS(css string) error
AddCSS reads the CSS instructions in css.
func (*CSSBuilder) BeforeShipout ¶
func (cb *CSSBuilder) BeforeShipout() error
BeforeShipout should be called when placing a CSS page in the PDF. It adds page margin boxes to the current page.
func (*CSSBuilder) CreateVlist ¶
func (cb *CSSBuilder) CreateVlist(te *frontend.Text, wd bag.ScaledPoint) (*node.VList, error)
CreateVlist converts the te into a big vlist.
func (*CSSBuilder) HTMLToText ¶
func (cb *CSSBuilder) HTMLToText(html string) (*frontend.Text, error)
HTMLToText interprets the HTML string and applies all previously read CSS data.
func (*CSSBuilder) InitPage ¶
func (cb *CSSBuilder) InitPage() error
InitPage makes sure that there is a valid page in the frontend.
func (*CSSBuilder) NewPage ¶
func (cb *CSSBuilder) NewPage() error
NewPage puts the current page into the PDF document and starts with a new page.
func (*CSSBuilder) OutputAt ¶
func (cb *CSSBuilder) OutputAt(text *frontend.Text, x, y, width bag.ScaledPoint) error
OutputAt places the text at the given coordinates and formats it to the given width. OutputAt inserts page breaks if necessary.
func (*CSSBuilder) OutputPage ¶
func (cb *CSSBuilder) OutputPage(html string) error
OutputPage outputs the HTML text and breaks pages when necessary.
func (*CSSBuilder) PageSize ¶
func (cb *CSSBuilder) PageSize() (PageDimensions, error)
PageSize returns a struct with the dimensions of the current page.
func (*CSSBuilder) ParseCSSString ¶
func (cb *CSSBuilder) ParseCSSString(css string) error
ParseCSSString reads CSS instructions from a string.
func (*CSSBuilder) ParseHTMLFromNode ¶
ParseHTMLFromNode interprets the HTML structure and applies all previously read CSS data.
func (*CSSBuilder) ReadCSSFile ¶
func (cb *CSSBuilder) ReadCSSFile(filename string) error
ReadCSSFile reads the given file name and tries to parse the CSS contents from the file.
type PageDimensions ¶
type PageDimensions struct { Width bag.ScaledPoint Height bag.ScaledPoint MarginLeft bag.ScaledPoint MarginRight bag.ScaledPoint MarginTop bag.ScaledPoint MarginBottom bag.ScaledPoint PageAreaLeft bag.ScaledPoint PageAreaTop bag.ScaledPoint ContentWidth bag.ScaledPoint ContentHeight bag.ScaledPoint // contains filtered or unexported fields }
PageDimensions contains the page size and the margins of the page.