internal

package
v0.0.0-...-a6b6dca Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCode

func NewCode(pdf fpdf.Fpdf, math Math) *code

NewCode create a Code.

func NewFont

func NewFont(pdf fpdf.Fpdf, size float64, family string, style consts.Style) *font

NewFont create a Font.

func NewImage

func NewImage(pdf fpdf.Fpdf, math Math) *image

NewImage create an Image.

func NewLine

func NewLine(pdf fpdf.Fpdf) *line

NewLine create a Line Helper.

func NewMath

func NewMath(pdf fpdf.Fpdf) *math

NewMath create a Math.

func NewSignature

func NewSignature(pdf fpdf.Fpdf, math Math, text Text) *signature

NewSignature create a Signature.

func NewTableList

func NewTableList(text Text, font Font) *tableList

NewTableList create a TableList.

func NewText

func NewText(pdf fpdf.Fpdf, math Math, font Font) *text

NewText create a Text.

Types

type Cell

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

Cell represents a cell inside the PDF.

type Code

type Code interface {
	AddQr(code string, cell Cell, prop props.Rect)
	AddBar(code string, cell Cell, prop props.Barcode) (err error)
	AddDataMatrix(code string, cell Cell, prop props.Rect)
}

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

type Font

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

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

type Image

type Image interface {
	AddFromFile(path string, cell Cell, prop props.Rect) (err error)
	AddFromBase64(stringBase64 string, cell Cell, prop props.Rect, extension consts.Extension) (err error)
}

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

type Line

type Line interface {
	Draw(cell Cell, lineProp props.Line)
}

Line is the abstraction which deals with lines.

type MarotoGridPart

type MarotoGridPart interface {
	// Grid System.
	Row(height float64, closure func())
	Col(width uint, closure func())
	ColSpace(width uint)

	// Helpers.
	SetBackgroundColor(color color.Color)
	GetCurrentOffset() float64
	GetPageSize() (width float64, height float64)
	GetPageMargins() (left float64, top float64, right float64, bottom float64)

	// Outside Col/Row Components.
	Line(spaceHeight float64, line ...props.Line)

	// Inside Col/Row Components.
	Text(text string, prop ...props.Text)
}

MarotoGridPart is the abstraction to deal with the gris system inside the table list.

type Math

type Math interface {
	GetRectCenterColProperties(imageWidth float64, imageHeight float64, colWidth float64, colHeight float64,
		xColOffset float64, percent float64) (x float64, y float64, w float64, h float64)
	GetRectNonCenterColProperties(imageWidth float64, imageHeight float64, colWidth float64, colHeight float64,
		xColOffset float64, prop props.Rect) (x float64, y float64, w float64, h float64)
	GetCenterCorrection(outerSize, innerSize float64) float64
}

Math is the abstraction which deals with useful calc.

type Signature

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

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

type TableList

type TableList interface {
	Create(header []string, contents [][]string, defaultFontFamily string, prop ...props.TableList)
	BindGrid(part MarotoGridPart)
}

TableList is the abstraction to create a table with header and contents.

type Text

type Text interface {
	Add(text string, cell 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
examples
zpl

Jump to

Keyboard shortcuts

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