pdf

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ValignTop    = 1
	ValignMiddle = 2
	ValignBottom = 3
	AlignLeft    = 4
	AlignCenter  = 5
	AlignRight   = 6
)

Variables

View Source
var (
	ColorTableLine = Color{
		R: 0,
		G: 0,
		B: 0,
	}

	ColorWhite = Color{
		R: 255,
		G: 255,
		B: 255,
	}

	ColorGray = Color{
		R: 211,
		G: 211,
		B: 211,
	}

	ColorBlack = ColorTableLine
)

Functions

This section is empty.

Types

type AddPagePipe

type AddPagePipe interface {
	Before(p PDF)
	After(p PDF)
}

type Color

type Color struct {
	R, G, B, A uint8
}

type NormalTable

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

func GetNormalTable

func GetNormalTable() *NormalTable

func (*NormalTable) AddHeader

func (nti *NormalTable) AddHeader(thc TableHeaderColumn)

func (*NormalTable) AddRow

func (nti *NormalTable) AddRow(r []*TableColumn)

func (*NormalTable) Draw

func (nti *NormalTable) Draw(p PDF, style TableStyle, app ...AddPagePipe)

func (*NormalTable) DrawWithPosition

func (nti *NormalTable) DrawWithPosition(p PDF, style TableStyle, px, py float64)

type PDF

type PDF interface {
	WriteToFile(filepath string) error
	Write(w io.Writer) error
	AddPagePipe(pp ...AddPagePipe)
	AddPage()
	Text(text string, style TextStyle, align int)
	Br(h float64)

	GetX() float64
	GetY() float64
	SetX(x float64)
	SetY(y float64)
	GetBottomHeight() float64
	GetBottomMargin() float64
	GetLeftMargin() float64
	GetRightMargin() float64
	GetHeight() float64
	NewLine(width float64)
	NewDashLine(width float64)
	LineWithPosition(width float64, x1, y1, x2, y2 float64)
	RectFillDrawColor(text string, style TextBlockStyle, w, h float64, align, valign int)
	ImageReader(imageByte io.Reader, x, y, w, h, alpha float64) error
	MeasureTextWidth(txt string) (float64, error)
}

func GetA4HPDF

func GetA4HPDF(conf *PdfConf, leftMargin, rightMargin, topMargin, bottomMargin float64) PDF

func GetA4PDF

func GetA4PDF(conf *PdfConf, leftMargin, rightMargin, topMargin, bottomMargin float64) PDF

type PdfConf

type PdfConf struct {
	Font PdfFont
}

type PdfFont

type PdfFont map[string]string

type TableColumn

type TableColumn struct {
	Text   []string
	Width  float64
	Height float64
	Align  []int
}

func GetTableColumn

func GetTableColumn(w, h float64, align []int, text ...string) *TableColumn

type TableHeaderColumn

type TableHeaderColumn struct {
	Main TableColumn
	Sub  []TableColumn
}

func (*TableHeaderColumn) AddSub

func (thc *TableHeaderColumn) AddSub(text string, width, height float64)

type TableStyle

type TableStyle interface {
	Header() TextBlockStyle
	Data() TextBlockStyle
}

type TextBlockStyle

type TextBlockStyle struct {
	TextStyle
	BackGround Color
	W, H       float64
	TextAlign  string
}

func (*TextBlockStyle) GetAlign

func (tbs *TextBlockStyle) GetAlign() int

type TextStyle

type TextStyle struct {
	Font     string
	FontSize int
	Color    Color
	Style    string
}

Jump to

Keyboard shortcuts

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