gopdf

package
v0.0.0-...-1272ae6 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIV_STRAIGHT = 1 // 实线边框
	DIV_DASHED   = 2 // 虚线边框
	DIV_DOTTED   = 3 // 点状线的边框
	DIV_NONE     = 4 // 无边框
)

Variables

This section is empty.

Functions

func ConvertPNG2JPEG

func ConvertPNG2JPEG(srcPath, dstPath string) (err error)

func DrawPNG

func DrawPNG(srcPath string)

func GetImageType

func GetImageType(picturePath string) (pictureType string, err error)

func GetImageWidthAndHeight

func GetImageWidthAndHeight(picturePath string) (w, h int)

Types

type Div

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

带有各种边框的内容, 可以自动换行

func NewDiv

func NewDiv(lineHeight, lineSpce float64, pdf *core.Report) *Div

func NewDivWithWidth

func NewDivWithWidth(width float64, lineHeight, lineSpce float64, pdf *core.Report) *Div

func (*Div) Copy

func (div *Div) Copy(content string) *Div

func (*Div) GenerateAtomicCell

func (div *Div) GenerateAtomicCell() error

自动分页

func (*Div) GetHeight

func (div *Div) GetHeight() (height float64)

func (*Div) GetWidth

func (div *Div) GetWidth() (width float64)

func (*Div) HorizontalCentered

func (div *Div) HorizontalCentered() *Div

func (*Div) RightAlign

func (div *Div) RightAlign() *Div

func (*Div) SetBackColor

func (div *Div) SetBackColor(color string) *Div

func (*Div) SetBorder

func (div *Div) SetBorder(border core.Scope) *Div

func (*Div) SetContent

func (div *Div) SetContent(content string) *Div

func (*Div) SetFont

func (div *Div) SetFont(font core.Font) *Div

func (*Div) SetFontColor

func (div *Div) SetFontColor(color string) *Div

func (*Div) SetFontWithColor

func (div *Div) SetFontWithColor(font core.Font, color string) *Div

func (*Div) SetFrameType

func (div *Div) SetFrameType(frameType int) *Div

func (*Div) SetMarign

func (div *Div) SetMarign(margin core.Scope) *Div

type HLine

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

func NewHLine

func NewHLine(pdf *core.Report) *HLine

func (*HLine) GenerateAtomicCell

func (h *HLine) GenerateAtomicCell()

func (*HLine) SetColor

func (h *HLine) SetColor(color float64) *HLine

func (*HLine) SetMargin

func (h *HLine) SetMargin(margin core.Scope) *HLine

func (*HLine) SetWidth

func (h *HLine) SetWidth(width float64) *HLine

type Image

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

func NewImage

func NewImage(path string, pdf *core.Report) *Image

func NewImageFromServer

func NewImageFromServer(path string, pdf *core.Report) *Image

NewImageFromServer 从远程请求图片

func NewImageWithWidthAndHeight

func NewImageWithWidthAndHeight(path string, width, height float64, pdf *core.Report) *Image

func NewServerImage

func NewServerImage(url, path string, pdf *core.Report) (img *Image, err error)

NewServerImage 获取远程 图片

func (*Image) GenerateAtomicCell

func (image *Image) GenerateAtomicCell() error

自动换行

func (*Image) GetHeight

func (image *Image) GetHeight() float64

func (*Image) GetWidth

func (image *Image) GetWidth() float64

func (*Image) SetMargin

func (image *Image) SetMargin(margin core.Scope) *Image

type Span

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

不会进行自动分页, 可以用于页眉, 页脚的内容.

func NewSpan

func NewSpan(lineHeight, lineSpce float64, pdf *core.Report) *Span

func NewSpanWithWidth

func NewSpanWithWidth(width float64, lineHeight, lineSpce float64, pdf *core.Report) *Span

func (*Span) Copy

func (span *Span) Copy(content string) *Span

func (*Span) GenerateAtomicCell

func (span *Span) GenerateAtomicCell() error

func (*Span) GetHeight

func (span *Span) GetHeight() (height float64)

func (*Span) GetWidth

func (span *Span) GetWidth() (width float64)

func (*Span) HorizontalCentered

func (span *Span) HorizontalCentered() *Span

func (*Span) RightAlign

func (span *Span) RightAlign() *Span

func (*Span) SetBorder

func (span *Span) SetBorder(border core.Scope) *Span

func (*Span) SetContent

func (span *Span) SetContent(content string) *Span

func (*Span) SetFont

func (span *Span) SetFont(font core.Font) *Span

func (*Span) SetFontColor

func (span *Span) SetFontColor(color string) *Span

func (*Span) SetFontWithColor

func (span *Span) SetFontWithColor(font core.Font, color string) *Span

func (*Span) SetHeight

func (span *Span) SetHeight(height float64) *Span

func (*Span) SetMarign

func (span *Span) SetMarign(margin core.Scope) *Span

func (*Span) VerticalCentered

func (span *Span) VerticalCentered() *Span

type Table

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

构建表格

func NewTable

func NewTable(cols, rows int, width, lineHeight float64, pdf *core.Report) *Table

func (*Table) GenerateAtomicCell

func (table *Table) GenerateAtomicCell() error

func (*Table) GetColWidth

func (table *Table) GetColWidth(row, col int) float64

获取某列的宽度

func (*Table) NewCell

func (table *Table) NewCell() *TableCell

创建长宽为1的单元格

func (*Table) NewCellByRange

func (table *Table) NewCellByRange(w, h int) *TableCell

创建固定长度的单元格

func (*Table) SetLineHeight

func (table *Table) SetLineHeight(lineHeight float64)

设置表的行高, 行高必须大于当前使用字体的行高

func (*Table) SetMargin

func (table *Table) SetMargin(margin core.Scope)

设置表的外

type TableCell

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

func (*TableCell) SetElement

func (cell *TableCell) SetElement(e core.Cell) *TableCell

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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