pdf

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIVSTRAIGHT = 1 // 实线边框
	DIVDASHED   = 2 // 虚线边框
	DIVDOTTED   = 3 // 点状线的边框
	DIVNONE     = 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, lineSpace float64, pdf *core.Report) *Div

NewDiv return a *div

func NewDivWithWidth

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

NewDivWithWidth return a *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

SetBorder set border

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 *Div) SetLink(x, y float64, content, link string) *Div

添加外部链接

func (div *Div) SetLink(x, y, th float64, content, link string) *Div {
	div.pdf.Font(div.font.Family, div.font.Size, div.font.Style)
	div.pdf.SetFontWithStyle(div.font.Family, div.font.Style, div.font.Size)
	div.pdf.ExternalLink(div.width, div.height, div.lineHeight, content, link)
	return div
}

func (*Div) SetMargin

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

type HLine

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

func NewHLine

func NewHLine(pdf *core.Report) *HLine

NewHLine return a *HList

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

type TextCell

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

func NewTextCell

func NewTextCell(width, lineHeight, lineSpace float64, pdf *core.Report) *TextCell

func (*TextCell) Copy

func (cell *TextCell) Copy(content string) *TextCell

func (*TextCell) GenerateAtomicCell

func (cell *TextCell) GenerateAtomicCell(maxheight float64) (int, int, error)

先涂背景颜色, 然后在背景颜色的基础上写入内容

func (*TextCell) GetHeight

func (cell *TextCell) GetHeight() float64

func (*TextCell) GetLastHeight

func (cell *TextCell) GetLastHeight() float64

func (*TextCell) HorizontalCentered

func (cell *TextCell) HorizontalCentered() *TextCell

func (*TextCell) RightAlign

func (cell *TextCell) RightAlign() *TextCell

func (*TextCell) SetBackColor

func (cell *TextCell) SetBackColor(color string) *TextCell

func (*TextCell) SetBorder

func (cell *TextCell) SetBorder(border core.Scope) *TextCell

func (*TextCell) SetContent

func (cell *TextCell) SetContent(s string) *TextCell

func (*TextCell) SetFont

func (cell *TextCell) SetFont(font core.Font) *TextCell

func (*TextCell) SetFontColor

func (cell *TextCell) SetFontColor(color string) *TextCell

func (*TextCell) SetFontWithColor

func (cell *TextCell) SetFontWithColor(font core.Font, color string) *TextCell

func (*TextCell) TryGenerateAtomicCell

func (cell *TextCell) TryGenerateAtomicCell(maxheight float64) (int, int)

func (*TextCell) VerticalCentered

func (cell *TextCell) VerticalCentered() *TextCell

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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