gopdf

package
v0.0.0-...-86c5517 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithGoPdf

func WithGoPdf(ctx context.Context, c InitConfig) pdf.Option

Types

type Impl

type Impl struct {
	Width  float64
	Height float64
	GoPdf  *gopdf.GoPdf
	// contains filtered or unexported fields
}

func (Impl) AddFont

func (f Impl) AddFont(family string, styleStr string, data []byte) error
func (f Impl) AddInternalLink(anchor string)

func (Impl) AddPage

func (f Impl) AddPage()

Add a new page

func (Impl) BR

func (f Impl) BR(height float64)

func (Impl) CellFormat

func (f Impl) CellFormat(w float64, h float64, txtStr string, borderStr string, ln int, alignStr string, fill bool, link int, linkStr string)

func (Impl) GetMargins

func (f Impl) GetMargins() (left, top, right, bottom float64)

func (Impl) GetPageSize

func (f Impl) GetPageSize() (width float64, height float64)

Page size

func (Impl) GetX

func (f Impl) GetX() float64

Position

func (Impl) GetY

func (f Impl) GetY() float64

func (Impl) Line

func (f Impl) Line(x1 float64, y1 float64, x2 float64, y2 float64)

func (Impl) MeasureTextWidth

func (f Impl) MeasureTextWidth(text string) float64

Measuring

func (Impl) RegisterImage

func (f Impl) RegisterImage(id string, format string, src io.Reader)

Images

func (Impl) SetDrawColor

func (f Impl) SetDrawColor(r uint8, g uint8, b uint8)

Colors

func (Impl) SetFillColor

func (f Impl) SetFillColor(r uint8, g uint8, b uint8)

func (Impl) SetFont

func (f Impl) SetFont(family string, style string, size int) error

func (Impl) SetLineWidth

func (f Impl) SetLineWidth(width float64)

Width

func (Impl) SetMarginLeft

func (f Impl) SetMarginLeft(margin float64)

Margins

func (Impl) SetMarginRight

func (f Impl) SetMarginRight(margin float64)

func (Impl) SetMarginTop

func (f Impl) SetMarginTop(margin float64)

func (Impl) SetTextColor

func (f Impl) SetTextColor(r uint8, g uint8, b uint8)

func (Impl) SetX

func (f Impl) SetX(x float64)

func (Impl) SetY

func (f Impl) SetY(y float64)

func (Impl) SplitText

func (f Impl) SplitText(text string, width float64) []string

func (Impl) UseImage

func (f Impl) UseImage(imgID string, x, y, w, h float64)

func (Impl) Write

func (f Impl) Write(w io.Writer) error
func (f Impl) WriteExternalLink(h float64, text string, destination string)
func (f Impl) WriteInternalLink(h float64, text string, anchor string)

func (Impl) WriteText

func (f Impl) WriteText(h float64, text string)

Writing

type InitConfig

type InitConfig struct {
	Title   string
	Subject string

	PaperSize *gopdf.Rect // Default A4
}

Jump to

Keyboard shortcuts

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