Documentation ¶
Index ¶
- type OutputStyle
- type Stamp
- func (s *Stamp) AddCanvas(id string, x1Pct, y1Pct, x2Pct, y2Pct float64)
- func (s *Stamp) AddMultilineTextCell(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, lineheightPct float64, ...)
- func (s *Stamp) AddTextCell(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, font string, ...)
- func (s *Stamp) DeriveFontsize(cellWidthPt, cellHeightPt float64, font string, fontsize float64, text string) (result float64)
- func (s *Stamp) DeriveY2(canvasID string, y1Pct, y2Pct, fontsizePt float64) (y2 float64)
- func (s *Stamp) DrawCanvasGrid(canvasID string) (err error)
- func (s *Stamp) DrawCanvases()
- func (s *Stamp) DrawLine(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, os OutputStyle)
- func (s *Stamp) DrawRectangle(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, os OutputStyle)
- func (s *Stamp) DrawStrikeoutArea(canvasID string, x1Pct, y1Pct, x2Pct, y2Pct float64, os OutputStyle)
- func (s *Stamp) DrawStrikeoutCentered(canvasID string, xPct, yPct, sizePt float64, os OutputStyle)
- func (s *Stamp) GetDimensionsWithOffset() (x, y float64)
- func (s *Stamp) SetCellBorder(shouldDrawBorder bool)
- func (s *Stamp) SetPageCanvas(x1Pct, y1Pct, x2Pct, y2Pct float64)
- func (s *Stamp) WriteToFile(filename string) (err error)
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 (*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 ¶
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 ¶
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 ¶
GetDimensionsWithOffset returns the x/y dimensions of this stamp minus its offsets
func (*Stamp) SetCellBorder ¶
SetCellBorder sets whether the border around cells should be drawn.
func (*Stamp) SetPageCanvas ¶
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 ¶
WriteToFile writes the content of the Stamp object into a PDF file. The Stamp object should not be used anymore after that.