core

package
v2.0.0-alpha.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 9 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	X      float64
	Y      float64
	Width  float64
	Height float64
}

Cell represents a cell inside the PDF.

func NewRootContext

func NewRootContext(pageWidth, pageHeight float64, margins Margins) Cell

func (Cell) Copy

func (c Cell) Copy() Cell

type Col

type Col interface {
	Node
	Add(components ...Component) Col
	GetSize() int
	WithStyle(style *props.Cell) Col
	Render(provider Provider, cell Cell, createCell bool)
}

type Component

type Component interface {
	Node
	Render(provider Provider, cell Cell)
}

type Document

type Document interface {
	GetBytes() []byte
	GetBase64() string
	Save(file string) error
	GetReport() *metrics.Report
}

func NewDocument

func NewDocument(bytes []byte, report *metrics.Report) Document

type Margins

type Margins struct {
	Left   float64
	Right  float64
	Top    float64
	Bottom float64
}

func (*Margins) Print

func (m *Margins) Print()

type Maroto

type Maroto interface {
	RegisterHeader(rows ...Row) error
	RegisterFooter(rows ...Row) error
	AddRows(rows ...Row)
	AddRow(rowHeight float64, cols ...Col) Row
	AddPages(pages ...Page)
	AddPDFs(pdfs ...[]byte)
	GetStructure() *tree.Node[Structure]
	Generate() (Document, error)
}

type Node

type Node interface {
	SetConfig(config *config.Config)
	GetStructure() *tree.Node[Structure]
}

type Page

type Page interface {
	Node
	Add(rows ...Row) Page
	GetRows() []Row
	GetNumber() int
	SetNumber(number int, total int)
	Render(provider Provider, cell Cell)
}

type Provider

type Provider interface {
	// Grid
	CreateRow(height float64)
	CreateCol(width, height float64, config *config.Config, prop *props.Cell)

	// Features
	AddLine(cell Cell, prop props.Line)
	AddText(text string, cell Cell, prop props.Text)
	AddSignature(text string, cell Cell, prop props.Text)
	AddMatrixCode(code string, cell Cell, prop props.Rect)
	AddQrCode(code string, cell Cell, rect props.Rect)
	AddBarCode(code string, cell Cell, prop props.Barcode)
	AddImage(value string, cell Cell, prop props.Rect, extension extension.Type)

	// General
	GetDimensions() (width float64, height float64)
	GetMargins() (left float64, top float64, right float64, bottom float64)
	GenerateFile(file string) error
	GenerateBytes() ([]byte, error)
	SetCache(cache cache.Cache)

	SetProtection(protection *config.Protection)
	SetCompression(compression bool)
	SetMetadata(metadata *config.Metadata)
}

type Row

type Row interface {
	Node
	Add(cols ...Col) Row
	GetHeight() float64
	WithStyle(style *props.Cell) Row
	Render(provider Provider, cell Cell)
}

type Structure

type Structure struct {
	Type  string
	Value string
	Props map[string]string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL