internal

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Barcode added in v1.1.1

func Barcode(pdf barcodePdf, code string, x, y, w, h float64, flow bool)

Barcode puts a registered barcode in the current page.

The size should be specified in the units used to create the PDF document. If width or height are left unspecfied, the barcode is not scaled in the unspecified dimensions.

Positioning with x, y and flow is inherited from Fpdf.Image().

func BarcodeUnscalable added in v1.1.1

func BarcodeUnscalable(pdf barcodePdf, code string, x, y float64, w, h *float64, flow bool)

BarcodeUnscalable puts a registered barcode in the current page.

Its arguments work in the same way as that of Barcode(). However, it allows for an unscaled barcode in the width and/or height dimensions. This can be useful if you want to prevent side effects of upscaling.

func GetUnscaledBarcodeDimensions added in v1.1.1

func GetUnscaledBarcodeDimensions(pdf barcodePdf, code string) (w, h float64)

GetUnscaledBarcodeDimensions returns the width and height of the unscaled barcode associated with the given code.

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

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

func Register added in v1.1.1

func Register(bcode barcode.Barcode) string

Register registers a barcode but does not put it on the page. Use Barcode() with the same code to put the barcode on the PDF page.

func RegisterAztec added in v1.1.1

func RegisterAztec(pdf barcodePdf, code string, minECCPercent int, userSpecifiedLayers int) string

RegisterAztec registers a barcode of type Aztec to the PDF, but not to the page. Use Barcode() with the return value to put the barcode on the page. code is the string to be encoded. minECCPercent is the error correction percentage. 33 is the default. userSpecifiedLayers can be a value between -4 and 32 inclusive.

func RegisterCodabar added in v1.1.1

func RegisterCodabar(pdf barcodePdf, code string) string

RegisterCodabar registers a barcode of type Codabar to the PDF, but not to the page. Use Barcode() with the return value to put the barcode on the page.

func RegisterCode128 added in v1.1.1

func RegisterCode128(pdf barcodePdf, code string) string

RegisterCode128 registers a barcode of type Code128 to the PDF, but not to the page. Use Barcode() with the return value to put the barcode on the page.

func RegisterCode39 added in v1.1.1

func RegisterCode39(pdf barcodePdf, code string, includeChecksum, fullASCIIMode bool) string

RegisterCode39 registers a barcode of type Code39 to the PDF, but not to the page. Use Barcode() with the return value to put the barcode on the page.

includeChecksum and fullASCIIMode are inherited from code39.Encode().

func RegisterDataMatrix added in v1.1.1

func RegisterDataMatrix(pdf barcodePdf, code string) string

RegisterDataMatrix registers a barcode of type DataMatrix to the PDF, but not to the page. Use Barcode() with the return value to put the barcode on the page.

func RegisterEAN added in v1.1.1

func RegisterEAN(pdf barcodePdf, code string) string

RegisterEAN registers a barcode of type EAN to the PDF, but not to the page. It will automatically detect if the barcode is EAN8 or EAN13. Use Barcode() with the return value to put the barcode on the page.

func RegisterPdf417 added in v1.1.1

func RegisterPdf417(pdf barcodePdf, code string, columns int, securityLevel int) string

RegisterPdf417 registers a barcode of type Pdf417 to the PDF, but not to the page. code is the string to be encoded. columns specifies the number of barcode columns; this should be a value between 1 and 30 inclusive. securityLevel specifies an error correction level between zero and 8 inclusive. Barcodes for use with FedEx must set columns to 10 and securityLevel to 5. Use Barcode() with the return value to put the barcode on the page.

func RegisterQR added in v1.1.1

func RegisterQR(pdf barcodePdf, code string, ecl qr.ErrorCorrectionLevel, mode qr.Encoding) string

RegisterQR registers a barcode of type QR to the PDF, but not to the page. Use Barcode() with the return value to put the barcode on the page.

The ErrorCorrectionLevel and Encoding mode are inherited from qr.Encode().

func RegisterTwoOfFive added in v1.1.1

func RegisterTwoOfFive(pdf barcodePdf, code string, interleaved bool) string

RegisterTwoOfFive registers a barcode of type TwoOfFive to the PDF, but not to the page. Use Barcode() with the return value to put the barcode on the page.

The interleaved bool is inherited from twooffive.Encode().

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

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

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

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