Documentation ¶
Index ¶
- func GetNaturalWidth(mc MeasureContext, elements []InlineElement) float64
- func New(options ...Option) renderer.Renderer
- func TableLayoutAutoCompact(r *Renderer, n *xast.Table, mc MeasureContext, borderBox HalfBounds) ([]float64, error)
- func TableLayoutAutoFilled(r *Renderer, n *xast.Table, mc MeasureContext, borderBox HalfBounds) ([]float64, error)
- func TableLayoutEvenly(r *Renderer, n *xast.Table, mc MeasureContext, borderBox HalfBounds) ([]float64, error)
- type BlockStyle
- type Border
- type BorderEdge
- type DefaultImageLoader
- type DefaultImageLoaderErrorMode
- type DefaultStyler
- type HalfBounds
- type ImageElement
- type ImageLoader
- type IndividualBorder
- type InlineElement
- type LineBreakElement
- type MeasureContext
- type Option
- type PDFProvider
- type Rect
- type RenderContext
- type Renderer
- type Spacer
- type Spacing
- type Styler
- type TableLayout
- type TextElement
- type TextFormat
- type UniformBorder
- type VerticalCoord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNaturalWidth ¶
func GetNaturalWidth(mc MeasureContext, elements []InlineElement) float64
TODO リネーム
func TableLayoutAutoCompact ¶
func TableLayoutAutoCompact(r *Renderer, n *xast.Table, mc MeasureContext, borderBox HalfBounds) ([]float64, error)
TableLayoutAutoCompact determines the width of a column in proportion to the width of the column's content, but does not expand beyond the width required for the content
func TableLayoutAutoFilled ¶
func TableLayoutAutoFilled(r *Renderer, n *xast.Table, mc MeasureContext, borderBox HalfBounds) ([]float64, error)
TableLayoutAutoFilled is a TableLayout that expands the column width to fill the table by a ratio based on the width of the column content
func TableLayoutEvenly ¶
func TableLayoutEvenly(r *Renderer, n *xast.Table, mc MeasureContext, borderBox HalfBounds) ([]float64, error)
TableLayoutEvenly is a TableLayout that expands to fill the table so that each column is of equal width, without considering the column contents
Types ¶
type BlockStyle ¶
type BorderEdge ¶
type DefaultImageLoader ¶
type DefaultImageLoader struct { ErrorMode DefaultImageLoaderErrorMode // contains filtered or unexported fields }
func (*DefaultImageLoader) LoadImage ¶
func (il *DefaultImageLoader) LoadImage(src string) (img *ImageElement, err error)
type DefaultImageLoaderErrorMode ¶
type DefaultImageLoaderErrorMode int
const ( ReturnError DefaultImageLoaderErrorMode = iota IgnoreErrorAndShowAlt )
type DefaultStyler ¶
type DefaultStyler struct { FontFamily string FontSize float64 Color color.Color TableLayout TableLayout }
func (*DefaultStyler) Style ¶
func (s *DefaultStyler) Style(n ast.Node, tf TextFormat) (BlockStyle, TextFormat)
type HalfBounds ¶
type HalfBounds struct {
Left, Right float64
Top VerticalCoord
}
HalfBounds represents a bounds on the left, right and top coordinates.
func (HalfBounds) Expand ¶
func (b HalfBounds) Expand(spacers ...Spacer) HalfBounds
func (HalfBounds) Shrink ¶
func (b HalfBounds) Shrink(spacers ...Spacer) HalfBounds
func (HalfBounds) ToRect ¶
func (b HalfBounds) ToRect(Bottom VerticalCoord) Rect
func (HalfBounds) Width ¶
func (b HalfBounds) Width() float64
type ImageElement ¶
type ImageElement struct { Name string ImageType string // see ImageType of fpdf.ImageOptions Width, Height float64 Bytes []byte }
ImageElement は、単一の画像です
func (*ImageElement) String ¶
func (t *ImageElement) String() string
type ImageLoader ¶
type ImageLoader interface {
LoadImage(string) (*ImageElement, error)
}
type IndividualBorder ¶
type IndividualBorder struct {
Left, Top, Right, Bottom BorderEdge
}
type InlineElement ¶
type InlineElement interface { String() string // contains filtered or unexported methods }
InlineElement は PDFに描画されるインラインの要素であり、テキストか画像の2種類があります
type LineBreakElement ¶
type LineBreakElement struct {
Format TextFormat
}
LineBreakElement は、改行を表すインライン要素です
func (*LineBreakElement) String ¶
func (t *LineBreakElement) String() string
type MeasureContext ¶
type MeasureContext interface { GetTextWidth(span *TextElement) float64 GetSubText(span *TextElement, width float64) *TextElement GetPageVerticalBounds(page int) (float64, float64) GetRenderContext(fn func(RenderContext) error) error }
MeasureContext provides a way to measure the dimensions of the drawing element.
type Option ¶
type Option func(*Renderer)
func WithImageLoader ¶
func WithImageLoader(imageLoader ImageLoader) Option
func WithPDFProvider ¶
func WithPDFProvider(pdfProvider PDFProvider) Option
func WithStyler ¶
type PDFProvider ¶
type Rect ¶
type Rect struct {
Left, Right float64
Top, Bottom VerticalCoord
}
Rect is a rectangle that can span multiple pages of a PDF document.
func (Rect) ToHalfBounds ¶
func (r Rect) ToHalfBounds() HalfBounds
type RenderContext ¶
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
func (*Renderer) AddOptions ¶
AddOptions does nothing
type Styler ¶
type Styler interface {
Style(ast.Node, TextFormat) (BlockStyle, TextFormat)
}
type TableLayout ¶
type TableLayout func(r *Renderer, n *xast.Table, mc MeasureContext, borderBox HalfBounds) ([]float64, error)
type TextElement ¶
type TextElement struct { Format TextFormat Text string }
TextElement は、単一のテキストフォーマットが設定された改行を含まないテキストを持つインライン要素です
func (*TextElement) String ¶
func (t *TextElement) String() string
type TextFormat ¶
type UniformBorder ¶
type VerticalCoord ¶
func (VerticalCoord) LessThan ¶
func (vc VerticalCoord) LessThan(vc2 VerticalCoord) bool