internal

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 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 gofpdf.Pdf, math Math) *code

NewCode create a Code

func NewFont

func NewFont(pdf gofpdf.Pdf, size float64, family consts.Family, style consts.Style) *font

NewFont create a Font

func NewImage

func NewImage(pdf gofpdf.Pdf, math Math) *image

NewImage create an Image

func NewMath

func NewMath(pdf gofpdf.Pdf) *math

NewMath create a Math

func NewSignature

func NewSignature(pdf gofpdf.Pdf, math Math, text Text) *signature

NewSignature create a Signature

func NewTableList added in v0.21.2

func NewTableList(text Text, font Font) *tableList

NewTableList create a TableList

func NewText

func NewText(pdf gofpdf.Pdf, math Math, font Font) *text

NewText create a Text

Types

type Cell added in v0.25.0

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)
}

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

type Font

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

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

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)

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

type TableList interface {
	Create(header []string, contents [][]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