Documentation
¶
Index ¶
- Constants
- Variables
- func Ptr[T any](f T) *T
- func Rectangle(gp *gopdf.GoPdf, x0 float64, y0 float64, x1 float64, y1 float64, style string, ...) error
- type AlignedElement
- type Box
- type Color
- type Column
- type Config
- type Element
- type Empty
- type Font
- type Image
- type Margin
- type PDF
- type Padding
- type PaddingElement
- type Page
- type PageSet
- type PositionedElement
- type RenderContext
- type Row
- type Text
- type Unit
Constants ¶
View Source
const ( AlignStart = "start" AlignCenter = "center" AlignEnd = "end" )
Variables ¶
View Source
var PageSizeA4 = gopdf.PageSizeA4
Functions ¶
Types ¶
type AlignedElement ¶ added in v1.2.1
type AlignedElement struct {
Element
HAlign string // "start", "center", "end"
VAlign string // "start", "center", "end"
}
func Align ¶ added in v1.2.1
func Align(el Element, hAlign, vAlign string) *AlignedElement
type Box ¶ added in v1.2.0
type Box struct {
Ratio float64
Width *float64
Height *float64
Background Color
CornerRadius [4]float64 // TL, TR, BR, BL
Children []Element
NoPadding bool
}
func (*Box) AspectRatio ¶ added in v1.2.0
func (*Box) FixedHeight ¶ added in v1.2.0
func (*Box) FixedWidth ¶ added in v1.2.0
type Column ¶
func (*Column) AspectRatio ¶
func (*Column) FixedHeight ¶ added in v1.1.1
func (*Column) FixedWidth ¶ added in v1.1.1
type Empty ¶ added in v1.2.0
Empty is a placeholder for empty elements in the document.
func (*Empty) AspectRatio ¶ added in v1.2.0
func (*Empty) FixedHeight ¶ added in v1.2.0
func (*Empty) FixedWidth ¶ added in v1.2.0
type Image ¶ added in v1.2.0
func (*Image) AspectRatio ¶ added in v1.2.0
func (*Image) FixedHeight ¶ added in v1.2.0
func (*Image) FixedWidth ¶ added in v1.2.0
type Margin ¶ added in v1.2.0
type Margin struct {
Top, Bottom, Left, Right float64
}
func DefaultMargin ¶ added in v1.2.0
func DefaultMargin() Margin
type PaddingElement ¶ added in v1.2.2
func Pad ¶ added in v1.2.2
func Pad(element Element, top, right, bottom, left float64) *PaddingElement
func (*PaddingElement) AspectRatio ¶ added in v1.2.2
func (p *PaddingElement) AspectRatio() float64
func (*PaddingElement) FixedHeight ¶ added in v1.2.2
func (p *PaddingElement) FixedHeight() *float64
func (*PaddingElement) FixedWidth ¶ added in v1.2.2
func (p *PaddingElement) FixedWidth() *float64
func (*PaddingElement) Render ¶ added in v1.2.2
func (p *PaddingElement) Render(ctx *RenderContext, x, y, width, height float64) error
type Page ¶ added in v1.2.0
func (*Page) AspectRatio ¶ added in v1.2.0
func (*Page) FixedHeight ¶ added in v1.2.0
func (*Page) FixedWidth ¶ added in v1.2.0
func (*Page) FooterHeight ¶ added in v1.2.0
func (*Page) HeaderHeight ¶ added in v1.2.0
type PositionedElement ¶ added in v1.2.1
type PositionedElement struct {
X, Y float64 // Absolute position on the page (in points)
Width *float64 // Optional fixed width
Height *float64 // Optional fixed height
Element Element // Wrapped inner element
}
PositionedElement represents an element that is positioned at a specific location on the page. Can not be used with an aspect ratio!
func (*PositionedElement) AspectRatio ¶ added in v1.2.1
func (p *PositionedElement) AspectRatio() float64
func (*PositionedElement) FixedHeight ¶ added in v1.2.1
func (p *PositionedElement) FixedHeight() *float64
func (*PositionedElement) FixedWidth ¶ added in v1.2.1
func (p *PositionedElement) FixedWidth() *float64
func (*PositionedElement) Render ¶ added in v1.2.1
func (p *PositionedElement) Render(ctx *RenderContext, x, y, _, _ float64) error
type RenderContext ¶ added in v1.2.0
type RenderContext struct {
PDF *gopdf.GoPdf
PageHeight float64
PageWidth float64
CursorY float64
Debug bool
}
func (*RenderContext) EnsureSpace ¶ added in v1.2.0
func (ctx *RenderContext) EnsureSpace(heightNeeded float64)
func (*RenderContext) MoveY ¶ added in v1.2.0
func (ctx *RenderContext) MoveY(offset float64)
type Row ¶
func (*Row) AspectRatio ¶
func (*Row) FixedHeight ¶ added in v1.1.1
func (*Row) FixedWidth ¶ added in v1.1.1
type Text ¶ added in v1.2.0
type Text struct {
Text string
Ratio float64
Width *float64
Height *float64
FontSize float64
FontName string
Color *Color
}
func (*Text) AspectRatio ¶ added in v1.2.0
func (*Text) FixedHeight ¶ added in v1.2.0
func (*Text) FixedWidth ¶ added in v1.2.0
type Unit ¶ added in v1.2.0
type Unit int
const ( UnitUnset Unit = gopdf.UnitUnset // No units were set, when conversion is called on nothing will happen UnitPT Unit = gopdf.UnitPT // Points UnitMM Unit = gopdf.UnitMM // Millimeters UnitCM Unit = gopdf.UnitCM // Centimeters UnitIN Unit = gopdf.UnitIN // Inches UnitPX Unit = gopdf.UnitPX // Pixels )
Click to show internal directories.
Click to hide internal directories.