internal

package
v0.37.8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: MIT Imports: 12 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 added in v0.37.1

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 added in v0.37.1

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 added in v0.37.1

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 added in v0.37.1

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

Line is the abstraction which deals with lines.

type MarotoGridPart added in v0.37.1

type MarotoGridPart interface {
	// Grid System.
	Row(height float64, closure func())
	Col(width uint, closure func())
	ColWithMaxGridSum(width uint, closure func(), maxGridSum float64)
	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)

	//
	SetBorder(on bool)
}

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 added in v0.37.1

type TableList interface {
	Create(header []string, contents [][]string, defaultFontFamily string, prop ...props.TableList) (line int)
	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