stamp

package
v0.0.0-...-71c6e05 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OutputStyle

type OutputStyle struct {
	Style               string // F=filled, D=outline, FD=both, default=D
	FillR, FillG, FillB int
	DrawR, DrawG, DrawB int
	TextR, TextG, TextB int
	Transparency        float64
	BlendMode           string
	Linewidth           float64
	Fontsize            float64
	CellMargin          float64
}

OutputStyle allows to provide only the required drawing parameters

type Stamp

type Stamp struct {
	// contains filtered or unexported fields
}

Stamp is a wraper for a PDF page

func NewStamp

func NewStamp(dimX, dimY, offsetX, offsetY float64) (s *Stamp)

NewStamp creates a new Stamp object.

func (*Stamp) AddCanvas

func (s *Stamp) AddCanvas(id string, x1Pct, y1Pct, x2Pct, y2Pct float64)

AddCanvas adds a canvas to the new internal canvas store.

func (*Stamp) AddMultilineTextCell

func (s *Stamp) AddMultilineTextCell(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, lineheightPct float64, font string, fontsize float64, align string, text string)

AddMultilineTextCell adds a text cell to the stamp.

func (*Stamp) AddTextCell

func (s *Stamp) AddTextCell(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, font string, fontsize float64, align string, text string, autoShrink bool)

AddTextCell adds a text cell to the stamp.

func (*Stamp) DeriveFontsize

func (s *Stamp) DeriveFontsize(cellWidthPt, cellHeightPt float64, font string, fontsize float64, text string) (result float64)

DeriveFontsize checks whether the provided text fits into the given width, if the current font and fontsize is used. If it does not fit, the size is reduced until it fits or until a minimum font size is reached.

func (*Stamp) DeriveY2

func (s *Stamp) DeriveY2(canvasID string, y1Pct, y2Pct, fontsizePt float64) (y2 float64)

DeriveY2 takes two coordinates on the Y axis and the fontsize, and in case the second coordinate is 0.0 will calculcate a proper y2 coordinate based on y1 and the fontsize.

func (*Stamp) DrawCanvasGrid

func (s *Stamp) DrawCanvasGrid(canvasID string) (err error)

DrawCanvasGrid overlays the stamp with a set of lines

func (*Stamp) DrawCanvases

func (s *Stamp) DrawCanvases()

DrawCanvases draws all canvases to the stamp

func (*Stamp) DrawLine

func (s *Stamp) DrawLine(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, os OutputStyle)

DrawLine draws a line on the stamp.

func (*Stamp) DrawRectangle

func (s *Stamp) DrawRectangle(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, os OutputStyle)

DrawRectangle draws a rectangle on the stamp.

func (*Stamp) DrawStrikeoutArea

func (s *Stamp) DrawStrikeoutArea(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, os OutputStyle)

DrawStrikeoutArea draws a strikeout cross on the stamp

func (*Stamp) DrawStrikeoutCentered

func (s *Stamp) DrawStrikeoutCentered(canvasID string, xPct, yPct, sizePt float64, os OutputStyle)

DrawStrikeoutCentered draws a strikeout cross on the stamp around an area

func (*Stamp) GetDimensionsWithOffset

func (s *Stamp) GetDimensionsWithOffset() (x, y float64)

GetDimensionsWithOffset returns the x/y dimensions of this stamp minus its offsets

func (*Stamp) SetCellBorder

func (s *Stamp) SetCellBorder(shouldDrawBorder bool)

SetCellBorder sets whether the border around cells should be drawn.

func (*Stamp) SetPageCanvas

func (s *Stamp) SetPageCanvas(x1Pct, y1Pct, x2Pct, y2Pct float64)

SetPageCanvas sets a new page canvas for this stamp. This function may only be called as long as no entries are contained in the Stamps' internal canvas store

func (*Stamp) WriteToFile

func (s *Stamp) WriteToFile(filename string) (err error)

WriteToFile writes the content of the Stamp object into a PDF file. The Stamp object should not be used anymore after that.

Jump to

Keyboard shortcuts

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