Documentation
¶
Index ¶
- func DrawRectCell(pdf *gopdf.GoPdf, text string, fontSize int, x, y, w, h float64, color Color, ...)
- func DrawRectMultiCell(pdf *gopdf.GoPdf, text string, fontSize int, x, y, w, h float64, ...)
- func ToTableData(data interface{}) []map[string]string
- type CellStyle
- type Color
- type Column
- type FontStyle
- type Form
- type FormUnit
- type Halign
- type Header
- type Pdf
- func (p *Pdf) AddFont(fontname, fontpath string) error
- func (p *Pdf) AddFonts(fonts map[string]string) error
- func (p *Pdf) AddForm(form *Form) error
- func (p *Pdf) AddHeader(header *Header) error
- func (p *Pdf) AddPage()
- func (p *Pdf) AddTable(table *Table) error
- func (p *Pdf) AddText(text *Text) error
- func (p *Pdf) Save() error
- func (p *Pdf) SetFont(style *FontStyle) *gopdf.GoPdf
- func (p *Pdf) UpdateXY(xy XY) XY
- type Table
- type Text
- type UnitStyle
- type Valign
- type XY
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DrawRectCell ¶
func DrawRectCell(pdf *gopdf.GoPdf, text string, fontSize int, x, y, w, h float64, color Color, align Halign, valign Valign, )
//////////////////////////////////////////////////
func DrawRectMultiCell ¶
func ToTableData ¶
Types ¶
type CellStyle ¶
type CellStyle struct {
Background Color
Font string
FontColor Color
FontSize int
H_Align Halign
V_Align Valign
}
格子样式
type Column ¶
type Column struct {
//Size int
Width float64 // 宽度
AutoFit bool // 自适应,未生效
ColumnSytle CellStyle
Name string // 列名
}
列
type Form ¶
type Pdf ¶
type Pdf struct {
FileName string //文件名
Fonts []string //已注册字体
CurrentFont *FontStyle // 当前字体
CurrentXY XY //当前位置
MaxWidth float64 // 内容区域最大宽度
MaxHeight float64 // 内容区域最大高度
// contains filtered or unexported fields
}
type Table ¶
type Table struct {
Name string // 表格名字,为空不显示
NameStyle FontStyle // 名字样式
Colums []Column // 列
Width float64 // 表格宽度
Data []map[string]string // 数据, 可通过ToTableData()转换
YPosition float64 // 起始Y坐标
RowHeight float64 // 行高
TitleStyle CellStyle // 表头样式
DataStyle CellStyle // 表格数据样式
ColumnDataStyles map[string]*CellStyle // 特定列数据样式, font, fontsize, fontcolor不生效
}
表格
type Text ¶
type Text struct {
Content string // 文本内容
//MaxWidth float64 // 文本最大宽度
TextStyle CellStyle // 文本样式
YPosition float64 // Y坐标
}
文本
type UnitStyle ¶
type UnitStyle struct {
NameWidth float64 // Name单元格的宽度
ValueWidth float64 // Value单元格的宽度
AutoFit bool // 自适应, 不生效
NameStyle CellStyle // Name单元格的样式
ValueStyle CellStyle // Value单元格的样式
}
表单
Click to show internal directories.
Click to hide internal directories.