painter

package module
v0.0.0-...-ff13c23 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

README

painter

Documentation

Overview

Package painter

Package painter

Index

Constants

View Source
const (
	FontSimhei = "simhei"

	FontNone   = ""
	FontBold   = "B"
	FontItalic = "I"

	AlignNone         = ""
	AlignCenterMiddle = gofpdf.AlignCenter + gofpdf.AlignMiddle
	AlignLeftMiddle   = gofpdf.AlignLeft + gofpdf.AlignMiddle
	AlignRightMiddle  = gofpdf.AlignRight + gofpdf.AlignMiddle
)

FontSimhei ...

View Source
const (
	Nonespan = 0
	Colspan  = 1
	Rowspan  = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	X, Y, Span int
	Type       uint8 // 0 colspan, 1 rowspan
	Text       string
	Font       string
	FontStyle  string
	FontSize   float64
}

type Color

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

func NewColor

func NewColor(r, g, b uint8) *Color

func (*Color) B

func (c *Color) B() uint8

func (*Color) G

func (c *Color) G() uint8

func (*Color) R

func (c *Color) R() uint8

func (*Color) RGB

func (c *Color) RGB() (uint8, uint8, uint8)

type HeadCell

type HeadCell struct {
	Text  string
	Width float64
}

type Painter

type Painter interface {
	Init(resource string) error
	GetName() string
	AddPage(wh ...float64) error
	Line(x1, y1, x2, y2, width float64, isDash bool) error
	Text(text, font, fontStyle string, fontSize, x, y, w, h float64, align string, color *Color, border string) error
	TextWithTransform(text, font, fontStyle string, fontSize, x, y, w, h, h2, angle float64, align string, color *Color) error
	RectText(text, font, fontStyle string, fontSize, hPerLine, x, y, w, h float64, color *Color) error
	Barcode(code string, x, y, w, h float64) error
	BarcodeWithTransform(code string, x, y, w, h, h2, angle float64) error
	Picture(pic string, x, y, w, h float64) error
	Rect(styleStr string, x, y, w, h float64) error
	QRCode(code string, x, y, w, h float64) error
	Table(startX, startY float64, font, fontStyle string, fontSize float64, table *Table) error
	MiShapeWithPinyin(text, font, fontStyle string, fontSize, x, y, w, hPinyin float64) error
	Output(writer io.Writer) error
}

type PdfPainter

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

func NewPdfPainter

func NewPdfPainter(w float64, h float64) *PdfPainter

func NewPdfPainterResource

func NewPdfPainterResource(w float64, h float64, resource string) (*PdfPainter, error)

func (*PdfPainter) AddPage

func (p *PdfPainter) AddPage(wh ...float64) error

func (*PdfPainter) Barcode

func (p *PdfPainter) Barcode(code string, x, y, w, h float64) error

func (*PdfPainter) BarcodeWithTransform

func (p *PdfPainter) BarcodeWithTransform(code string, x, y, w, h, h2, angle float64) error

func (*PdfPainter) GetName

func (p *PdfPainter) GetName() string

func (*PdfPainter) Init

func (p *PdfPainter) Init(resource string) error

func (*PdfPainter) Line

func (p *PdfPainter) Line(x1, y1, x2, y2, width float64, isDash bool) error

func (*PdfPainter) MiShape

func (p *PdfPainter) MiShape(x, y, w float64, wordNum int) error

func (*PdfPainter) MiShapeWithPinyin

func (p *PdfPainter) MiShapeWithPinyin(text, font, fontStyle string, fontSize, x, y, w, hPinyin float64) error

func (*PdfPainter) Output

func (p *PdfPainter) Output(writer io.Writer) error

func (*PdfPainter) Picture

func (p *PdfPainter) Picture(pic string, x, y, w, h float64) error

func (*PdfPainter) QRCode

func (p *PdfPainter) QRCode(code string, x, y, w, h float64) error

func (*PdfPainter) Rect

func (p *PdfPainter) Rect(styleStr string, x, y, w, h float64) error

func (*PdfPainter) RectText

func (p *PdfPainter) RectText(text, font, fontStyle string, fontSize, hPerLine, x, y, w, h float64, color *Color) error

func (*PdfPainter) Table

func (p *PdfPainter) Table(startX, startY float64, table *Table) error

func (*PdfPainter) Text

func (p *PdfPainter) Text(text, font, fontStyle string, fontSize, x, y, w, h float64, align string, color *Color, border string) error

func (*PdfPainter) TextWithTransform

func (p *PdfPainter) TextWithTransform(text, font, fontStyle string, fontSize, x, y, w, h, h2, angle float64, align string, color *Color) error

type Table

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

func NewTable

func NewTable(heads *TableHead, rows *TableRow) *Table

func (*Table) GetX

func (t *Table) GetX(col int) float64

func (*Table) GetY

func (t *Table) GetY(row int) float64

type TableHead

type TableHead struct {
	Font          string
	FontStyle     string
	FontSize      float64
	HeightPerLine float64
	Heads         []*HeadCell
}

type TableRow

type TableRow struct {
	Font          string
	FontStyle     string
	FontSize      float64
	HeightPerLine float64
	RowNums       int
	Spans         []*Cell
}

Jump to

Keyboard shortcuts

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