Documentation ¶
Overview ¶
Package col implements creation of columns.
Index ¶
- func New(size ...int) core.Col
- type Col
- func (c *Col) Add(components ...core.Component) core.Col
- func (c *Col) GetHeight(provider core.Provider, cell *entity.Cell) float64
- func (c *Col) GetSize() int
- func (c *Col) GetStructure() *node.Node[core.Structure]
- func (c *Col) Render(provider core.Provider, cell entity.Cell, createCell bool)
- func (c *Col) SetConfig(config *entity.Config)
- func (c *Col) WithStyle(style *properties.Cell) core.Col
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New is responsible to create an instance of core.Col.
Example ¶
ExampleNew demonstrates how to create a Col instance.
package main import ( "github.com/pchchv/bpdf" "github.com/pchchv/bpdf/components/col" "github.com/pchchv/bpdf/components/row" ) func main() { // size is an optional parameters, if not provided, bpdf // will apply the maximum size, even if custom size is applied. size := 12 col := col.New(size) row := row.New(10).Add(col) m := bpdf.New() m.AddRows(row) // Do things and generate _, _ = m.Generate() }
Output:
Types ¶
type Col ¶
type Col struct {
// contains filtered or unexported fields
}
func (*Col) Add ¶
Add is responsible to add a component to a core.Col.
Example ¶
ExampleCol_Add demonstrates how to add components to Col.
package main import ( "github.com/pchchv/bpdf" "github.com/pchchv/bpdf/components/code" "github.com/pchchv/bpdf/components/col" "github.com/pchchv/bpdf/components/row" "github.com/pchchv/bpdf/components/signature" "github.com/pchchv/bpdf/components/text" ) func main() { col := col.New() text := text.New("text content") qrCode := code.NewQr("qrcode") signature := signature.New("signature label") col.Add(text, qrCode, signature) row := row.New(10).Add(col) m := bpdf.New() m.AddRows(row) // Do things and generate _, _ = m.Generate() }
Output:
func (*Col) GetStructure ¶
GetStructure returns the Structure of a core.Col.
func (*Col) WithStyle ¶
func (c *Col) WithStyle(style *properties.Cell) core.Col
WithStyle sets the style for the column.
Example ¶
ExampleCol_WithStyle demonstrates how to add style to Col.
package main import ( "github.com/pchchv/bpdf" "github.com/pchchv/bpdf/components/col" "github.com/pchchv/bpdf/components/row" "github.com/pchchv/bpdf/consts/border" "github.com/pchchv/bpdf/consts/linestyle" "github.com/pchchv/bpdf/properties" ) func main() { col := col.New() col.WithStyle(&properties.Cell{ BackgroundColor: &properties.Color{ Red: 10, Green: 100, Blue: 150, }, BorderColor: &properties.Color{ Red: 55, Green: 10, Blue: 60, }, BorderType: border.Full, BorderThickness: 0.1, LineStyle: linestyle.Dashed, }) row := row.New(10).Add(col) m := bpdf.New() m.AddRows(row) // Do things and generate _, _ = m.Generate() }
Output:
Click to show internal directories.
Click to hide internal directories.