core

package
v2.0.0-alpha.36 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 11 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code interface {
	GenQr(code string) (*entity.Image, error)
	GenDataMatrix(code string) (*entity.Image, error)
	GenBar(code string, cell *entity.Cell, prop *props.Barcode) (*entity.Image, error)
}

Code is the abstraction which deals of how to add QrCodes or Barcode in a PDF.

type Col

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

type Component

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

type Document

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

func NewPDF

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

type Font

type Font interface {
	SetFamily(family string)
	SetStyle(style fontstyle.Type)
	SetSize(size float64)
	SetFont(family string, style fontstyle.Type, size float64)
	GetFamily() string
	GetStyle() fontstyle.Type
	GetSize() float64
	GetFont() (string, fontstyle.Type, float64)
	GetScaleFactor() (scaleFactor float64)
	SetColor(color *props.Color)
	GetColor() *props.Color
}

Font is the abstraction which deals of how to set fontstyle configurations.

type Image

type Image interface {
	Add(img *entity.Image, cell *entity.Cell, margins *entity.Margins, prop *props.Rect, extension extension.Type, flow bool) error
}

Image is the abstraction which deals of how to add images in a PDF.

type Line

type Line interface {
	Add(cell *entity.Cell, prop *props.Line)
}

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)
	GetStructure() *node.Node[Structure]
	Generate() (Document, error)
}

type Math

type Math interface {
	GetInnerCenterCell(inner *entity.Dimensions, outer *entity.Dimensions, percent float64) *entity.Cell
	GetInnerNonCenterCell(inner *entity.Dimensions, outer *entity.Dimensions, prop *props.Rect) *entity.Cell
}

Math is the abstraction which deals with useful calc.

type Node

type Node interface {
	SetConfig(config *entity.Config)
	GetStructure() *node.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 entity.Cell)
}

type Provider

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

	// Features
	AddLine(cell *entity.Cell, prop *props.Line)
	AddText(text string, cell *entity.Cell, prop *props.Text)
	AddSignature(text string, cell *entity.Cell, prop *props.Text)
	AddMatrixCode(code string, cell *entity.Cell, prop *props.Rect)
	AddQrCode(code string, cell *entity.Cell, rect *props.Rect)
	AddBarCode(code string, cell *entity.Cell, prop *props.Barcode)
	AddImageFromFile(value string, cell *entity.Cell, prop *props.Rect)
	AddImageFromBytes(bytes []byte, cell *entity.Cell, prop *props.Rect, extension extension.Type)
	AddBackgroundImageFromBytes(bytes []byte, cell *entity.Cell, prop *props.Rect, extension extension.Type)

	// General
	GenerateBytes() ([]byte, error)
	SetCache(cache cache.Cache)

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

type Row

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

type Signature

type Signature interface {
	AddSpaceFor(label string, cell *entity.Cell, textProp *props.Text)
}

Signature is the abstraction which deals of how to add a signature space inside PDF.

type Structure

type Structure struct {
	Type    string
	Value   interface{}
	Details map[string]interface{}
}

type Text

type Text interface {
	Add(text string, cell *entity.Cell, textProp *props.Text)
	GetLinesQuantity(text string, fontFamily props.Text, colWidth float64) int
}

Text is the abstraction which deals of how to add text inside PDF.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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