Documentation ¶
Overview ¶
Package creator is used for quickly generating pages and content with a simple interface. It is built on top of the model package to provide access to the most common operations such as creating text and image reports and manipulating existing pages.
Index ¶
- Constants
- Variables
- type AnchorPoint
- type Background
- type Block
- func (_bb *Block) AddAnnotation(annotation *_fee.PdfAnnotation)
- func (_gff *Block) Angle() float64
- func (_bfe *Block) Draw(d Drawable) error
- func (_eed *Block) DrawTemplate(c *Creator, r _fg.Reader, data interface{}, options *TemplateOptions) error
- func (_caa *Block) DrawWithContext(d Drawable, ctx DrawContext) error
- func (_fbg *Block) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_bfg *Block) GetMargins() (float64, float64, float64, float64)
- func (_cdd *Block) Height() float64
- func (_feed *Block) RotatedSize() (float64, float64)
- func (_fbac *Block) Scale(sx, sy float64)
- func (_bce *Block) ScaleToHeight(h float64)
- func (_cdea *Block) ScaleToWidth(w float64)
- func (_cde *Block) SetAngle(angleDeg float64)
- func (_cbe *Block) SetMargins(left, right, top, bottom float64)
- func (_ea *Block) SetPos(x, y float64)
- func (_gfb *Block) Width() float64
- type CellBorderSide
- type CellBorderStyle
- type CellHorizontalAlignment
- type CellVerticalAlignment
- type Chapter
- func (_aec *Chapter) Add(d Drawable) error
- func (_ggbg *Chapter) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_dfc *Chapter) GetHeading() *Paragraph
- func (_ceeb *Chapter) GetMargins() (float64, float64, float64, float64)
- func (_fbcb *Chapter) NewSubchapter(title string) *Chapter
- func (_adbc *Chapter) SetIncludeInTOC(includeInTOC bool)
- func (_gca *Chapter) SetMargins(left, right, top, bottom float64)
- func (_bde *Chapter) SetShowNumbering(show bool)
- type Chart
- func (_dfgb *Chart) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_gbee *Chart) GetMargins() (float64, float64, float64, float64)
- func (_beea *Chart) Height() float64
- func (_gccd *Chart) SetMargins(left, right, top, bottom float64)
- func (_afe *Chart) SetPos(x, y float64)
- func (_eccga *Chart) Width() float64
- type Color
- type ColorPoint
- type Creator
- func (_efga *Creator) AddPage(page *_fee.PdfPage) error
- func (_fceg *Creator) Context() DrawContext
- func (_gfgg *Creator) CreateFrontPage(genFrontPageFunc func(_dddd FrontpageFunctionArgs))
- func (_gfada *Creator) CreateTableOfContents(genTOCFunc func(_gacf *TOC) error)
- func (_aage *Creator) Draw(d Drawable) error
- func (_feea *Creator) DrawFooter(drawFooterFunc func(_fdgb *Block, _cfdff FooterFunctionArgs))
- func (_acf *Creator) DrawHeader(drawHeaderFunc func(_afdb *Block, _ebecd HeaderFunctionArgs))
- func (_fcd *Creator) DrawTemplate(r _fg.Reader, data interface{}, options *TemplateOptions) error
- func (_bdfg *Creator) EnableFontSubsetting(font *_fee.PdfFont)
- func (_aebe *Creator) Finalize() error
- func (_aeebe *Creator) Flip(flipH, flipV bool) error
- func (_abdg *Creator) GetOptimizer() _fee.Optimizer
- func (_fbacg *Creator) Height() float64
- func (_bebe *Creator) MoveDown(dy float64)
- func (_baa *Creator) MoveRight(dx float64)
- func (_bcab *Creator) MoveTo(x, y float64)
- func (_caca *Creator) MoveX(x float64)
- func (_aceda *Creator) MoveY(y float64)
- func (_bcfb *Creator) NewChapter(title string) *Chapter
- func (_dcd *Creator) NewCurve(x1, y1, cx, cy, x2, y2 float64) *Curve
- func (_fgbb *Creator) NewCurvePolygon(rings [][]_bg.CubicBezierCurve) *CurvePolygon
- func (_aaef *Creator) NewDivision() *Division
- func (_dec *Creator) NewEllipse(xc, yc, width, height float64) *Ellipse
- func (_ebdg *Creator) NewFilledCurve() *FilledCurve
- func (_ggc *Creator) NewImage(img *_fee.Image) (*Image, error)
- func (_edg *Creator) NewImageFromData(data []byte) (*Image, error)
- func (_dff *Creator) NewImageFromFile(path string) (*Image, error)
- func (_dfe *Creator) NewImageFromGoImage(goimg _a.Image) (*Image, error)
- func (_faae *Creator) NewInvoice() *Invoice
- func (_bffae *Creator) NewLine(x1, y1, x2, y2 float64) *Line
- func (_bfba *Creator) NewLinearGradientColor(colorPoints []*ColorPoint) *LinearShading
- func (_ebgc *Creator) NewList() *List
- func (_cfgc *Creator) NewPage() *_fee.PdfPage
- func (_cebb *Creator) NewPageBreak() *PageBreak
- func (_fef *Creator) NewParagraph(text string) *Paragraph
- func (_ggd *Creator) NewPolyBezierCurve(curves []_bg.CubicBezierCurve) *PolyBezierCurve
- func (_ebed *Creator) NewPolygon(points [][]_bg.Point) *Polygon
- func (_affc *Creator) NewPolyline(points []_bg.Point) *Polyline
- func (_dafd *Creator) NewRadialGradientColor(x float64, y float64, innerRadius float64, outerRadius float64, ...) *RadialShading
- func (_aaeg *Creator) NewRectangle(x, y, width, height float64) *Rectangle
- func (_dabcd *Creator) NewStyledParagraph() *StyledParagraph
- func (_ffb *Creator) NewStyledTOCLine(number, title, page TextChunk, level uint, style TextStyle) *TOCLine
- func (_dfac *Creator) NewTOC(title string) *TOC
- func (_cggb *Creator) NewTOCLine(number, title, page string, level uint) *TOCLine
- func (_ffgg *Creator) NewTable(cols int) *Table
- func (_befe *Creator) NewTextStyle() TextStyle
- func (_aaga *Creator) PageFinalize(pageFinalizeFunc func(_eagbd PageFinalizeFunctionArgs) error)
- func (_fbga *Creator) RotateDeg(angleDeg int64) error
- func (_dfde *Creator) SetForms(form *_fee.PdfAcroForm) error
- func (_dafb *Creator) SetOptimizer(optimizer _fee.Optimizer)
- func (_ddfc *Creator) SetOutlineTree(outlineTree *_fee.PdfOutlineTreeNode)
- func (_ecac *Creator) SetPageLabels(pageLabels _dd.PdfObject)
- func (_eff *Creator) SetPageMargins(left, right, top, bottom float64)
- func (_cfdf *Creator) SetPageSize(size PageSize)
- func (_aeec *Creator) SetPdfWriterAccessFunc(pdfWriterAccessFunc func(_ebdd *_fee.PdfWriter) error)
- func (_eaed *Creator) SetTOC(toc *TOC)
- func (_ccf *Creator) TOC() *TOC
- func (_ccce *Creator) Width() float64
- func (_cecg *Creator) Write(ws _fg.Writer) error
- func (_eedb *Creator) WriteToFile(outputPath string) error
- type Curve
- type CurvePolygon
- func (_gcgf *CurvePolygon) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_gecb *CurvePolygon) SetBorderColor(color Color)
- func (_addc *CurvePolygon) SetBorderOpacity(opacity float64)
- func (_fcacb *CurvePolygon) SetBorderWidth(borderWidth float64)
- func (_cbgb *CurvePolygon) SetFillColor(color Color)
- func (_efgc *CurvePolygon) SetFillOpacity(opacity float64)
- type Division
- func (_gag *Division) Add(d VectorDrawable) error
- func (_dfcg *Division) EnablePageWrap(enable bool)
- func (_egad *Division) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_cdeb *Division) Height() float64
- func (_abfcd *Division) Inline() bool
- func (_faab *Division) Margins() (_geda, _bbf, _gdfc, _debe float64)
- func (_aafc *Division) Padding() (_edba, _cgdc, _dfdb, _fbgab float64)
- func (_gccde *Division) SetBackground(background *Background)
- func (_dafe *Division) SetInline(inline bool)
- func (_afcg *Division) SetMargins(left, right, top, bottom float64)
- func (_cdbe *Division) SetPadding(left, right, top, bottom float64)
- func (_bbcg *Division) Width() float64
- type DrawContext
- type Drawable
- type Ellipse
- func (_fbce *Ellipse) BorderColor() Color
- func (_bbbcb *Ellipse) BorderOpacity() float64
- func (_agbg *Ellipse) BorderWidth() float64
- func (_ddea *Ellipse) FillColor() Color
- func (_bgec *Ellipse) FillOpacity() float64
- func (_ebdc *Ellipse) FitMode() FitMode
- func (_dbdb *Ellipse) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_caad *Ellipse) GetCoords() (float64, float64)
- func (_cbce *Ellipse) GetMargins() (float64, float64, float64, float64)
- func (_fcfb *Ellipse) Height() float64
- func (_ecae *Ellipse) Positioning() Positioning
- func (_cbcb *Ellipse) Scale(xFactor, yFactor float64)
- func (_bbff *Ellipse) ScaleToHeight(h float64)
- func (_ggcf *Ellipse) ScaleToWidth(w float64)
- func (_bfbg *Ellipse) SetBorderColor(col Color)
- func (_bdgcg *Ellipse) SetBorderOpacity(opacity float64)
- func (_eccc *Ellipse) SetBorderWidth(bw float64)
- func (_gfcg *Ellipse) SetCoords(xc, yc float64)
- func (_bdb *Ellipse) SetFillColor(col Color)
- func (_dabe *Ellipse) SetFillOpacity(opacity float64)
- func (_dgdg *Ellipse) SetFitMode(fitMode FitMode)
- func (_gdab *Ellipse) SetHeight(height float64)
- func (_bag *Ellipse) SetMargins(left, right, top, bottom float64)
- func (_defd *Ellipse) SetPositioning(position Positioning)
- func (_dcce *Ellipse) SetWidth(width float64)
- func (_cbbd *Ellipse) Width() float64
- type FilledCurve
- type FitMode
- type FooterFunctionArgs
- type FrontpageFunctionArgs
- type GraphicSVG
- func (_eedbb *GraphicSVG) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_ggdb *GraphicSVG) GetMargins() (float64, float64, float64, float64)
- func (_bfcb *GraphicSVG) Height() float64
- func (_fdbg *GraphicSVG) Scale(xFactor, yFactor float64)
- func (_cfec *GraphicSVG) ScaleToHeight(h float64)
- func (_gaff *GraphicSVG) ScaleToWidth(w float64)
- func (_ecdea *GraphicSVG) SetMargins(left, right, top, bottom float64)
- func (_bbgcb *GraphicSVG) SetPos(x, y float64)
- func (_ddca *GraphicSVG) Width() float64
- type HeaderFunctionArgs
- type HorizontalAlignment
- type Image
- func (_eeae *Image) ConvertToBinary() error
- func (_dagb *Image) FitMode() FitMode
- func (_adbga *Image) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_ffa *Image) GetHorizontalAlignment() HorizontalAlignment
- func (_cdbd *Image) GetMargins() (float64, float64, float64, float64)
- func (_cdac *Image) Height() float64
- func (_ada *Image) Scale(xFactor, yFactor float64)
- func (_fcgc *Image) ScaleToHeight(h float64)
- func (_ecacf *Image) ScaleToWidth(w float64)
- func (_dgcea *Image) SetAngle(angle float64)
- func (_daee *Image) SetEncoder(encoder _dd.StreamEncoder)
- func (_eede *Image) SetFitMode(fitMode FitMode)
- func (_gdfa *Image) SetHeight(h float64)
- func (_baff *Image) SetHorizontalAlignment(alignment HorizontalAlignment)
- func (_bcbd *Image) SetMargins(left, right, top, bottom float64)
- func (_fefe *Image) SetOpacity(opacity float64)
- func (_gaac *Image) SetPos(x, y float64)
- func (_beec *Image) SetWidth(w float64)
- func (_ffeb *Image) Width() float64
- type Invoice
- func (_gefe *Invoice) AddInfo(description, value string) (*InvoiceCell, *InvoiceCell)
- func (_dcef *Invoice) AddLine(values ...string) []*InvoiceCell
- func (_fdbb *Invoice) AddSection(title, content string)
- func (_afcc *Invoice) AddTotalLine(desc, value string) (*InvoiceCell, *InvoiceCell)
- func (_geeb *Invoice) AddressHeadingStyle() TextStyle
- func (_ddcc *Invoice) AddressStyle() TextStyle
- func (_gecbf *Invoice) AppendColumn(description string) *InvoiceCell
- func (_ebad *Invoice) BuyerAddress() *InvoiceAddress
- func (_bebgb *Invoice) Columns() []*InvoiceCell
- func (_abgc *Invoice) Date() (*InvoiceCell, *InvoiceCell)
- func (_bace *Invoice) DueDate() (*InvoiceCell, *InvoiceCell)
- func (_dfgdf *Invoice) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_adea *Invoice) InfoLines() [][2]*InvoiceCell
- func (_agdd *Invoice) InsertColumn(index uint, description string) *InvoiceCell
- func (_cbag *Invoice) Lines() [][]*InvoiceCell
- func (_ggcd *Invoice) Logo() *Image
- func (_adccb *Invoice) NewCell(value string) *InvoiceCell
- func (_faacb *Invoice) NewCellProps() InvoiceCellProps
- func (_fed *Invoice) NewColumn(description string) *InvoiceCell
- func (_cefg *Invoice) NoteHeadingStyle() TextStyle
- func (_efcg *Invoice) NoteStyle() TextStyle
- func (_dfgg *Invoice) Notes() (string, string)
- func (_efcc *Invoice) Number() (*InvoiceCell, *InvoiceCell)
- func (_bcad *Invoice) Sections() [][2]string
- func (_cfdc *Invoice) SellerAddress() *InvoiceAddress
- func (_gfcde *Invoice) SetAddressHeadingStyle(style TextStyle)
- func (_beab *Invoice) SetAddressStyle(style TextStyle)
- func (_bfddf *Invoice) SetBuyerAddress(address *InvoiceAddress)
- func (_gacde *Invoice) SetColumns(cols []*InvoiceCell)
- func (_fdce *Invoice) SetDate(date string) (*InvoiceCell, *InvoiceCell)
- func (_cbfg *Invoice) SetDueDate(dueDate string) (*InvoiceCell, *InvoiceCell)
- func (_afcea *Invoice) SetLogo(logo *Image)
- func (_ffcg *Invoice) SetNoteHeadingStyle(style TextStyle)
- func (_begc *Invoice) SetNoteStyle(style TextStyle)
- func (_eeba *Invoice) SetNotes(title, content string)
- func (_bcdbf *Invoice) SetNumber(number string) (*InvoiceCell, *InvoiceCell)
- func (_beedcc *Invoice) SetSellerAddress(address *InvoiceAddress)
- func (_aefa *Invoice) SetSubtotal(value string)
- func (_edaa *Invoice) SetTerms(title, content string)
- func (_eeadd *Invoice) SetTitle(title string)
- func (_fdaf *Invoice) SetTitleStyle(style TextStyle)
- func (_ddcbf *Invoice) SetTotal(value string)
- func (_fgce *Invoice) Subtotal() (*InvoiceCell, *InvoiceCell)
- func (_ecge *Invoice) Terms() (string, string)
- func (_gbfa *Invoice) Title() string
- func (_eeca *Invoice) TitleStyle() TextStyle
- func (_afae *Invoice) Total() (*InvoiceCell, *InvoiceCell)
- func (_bedg *Invoice) TotalLines() [][2]*InvoiceCell
- type InvoiceAddress
- type InvoiceCell
- type InvoiceCellProps
- type Line
- func (_cdae *Line) Color() Color
- func (_ccfe *Line) DashPattern() (_cgga []int64, _fbca int64)
- func (_ffaa *Line) FitMode() FitMode
- func (_adfbb *Line) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_eaegg *Line) GetCoords() (float64, float64, float64, float64)
- func (_fcegg *Line) GetMargins() (float64, float64, float64, float64)
- func (_adbd *Line) Height() float64
- func (_ecfg *Line) Length() float64
- func (_deec *Line) LineWidth() float64
- func (_dfeg *Line) Opacity() float64
- func (_fddb *Line) Positioning() Positioning
- func (_dbcg *Line) SetColor(color Color)
- func (_acag *Line) SetDashPattern(dashArray []int64, dashPhase int64)
- func (_ceff *Line) SetFitMode(fitMode FitMode)
- func (_aedga *Line) SetLineWidth(width float64)
- func (_dbdef *Line) SetMargins(left, right, top, bottom float64)
- func (_eacg *Line) SetOpacity(opacity float64)
- func (_bccg *Line) SetPositioning(positioning Positioning)
- func (_gdad *Line) SetStyle(style _bg.LineStyle)
- func (_dabf *Line) Style() _bg.LineStyle
- func (_dfea *Line) Width() float64
- type LinearShading
- func (_dggd *LinearShading) AddColorStop(color Color, point float64)
- func (_addb *LinearShading) AddPatternResource(block *Block) (_cfcce _dd.PdfObjectName, _adae error)
- func (_fdbbf *LinearShading) AddShadingResource(block *Block) (_dgfef _dd.PdfObjectName, _dged error)
- func (_dacg *LinearShading) SetAngle(angle float64)
- func (_acacc *LinearShading) SetAntiAlias(enable bool)
- func (_eddfc *LinearShading) SetBackgroundColor(backgroundColor Color)
- func (_dede *LinearShading) SetBoundingBox(x, y, width, height float64)
- func (_gcab *LinearShading) SetExtends(start bool, end bool)
- func (_bcfe *LinearShading) ToPdfShadingPattern() *_fee.PdfShadingPatternType2
- func (_gbaa *LinearShading) ToRGB() (float64, float64, float64)
- type List
- func (_abca *List) Add(item VectorDrawable) (*TextChunk, error)
- func (_acagc *List) AddTextItem(text string) (*StyledParagraph, *TextChunk, error)
- func (_aaed *List) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_cfba *List) Height() float64
- func (_aefe *List) Indent() float64
- func (_gbafa *List) Margins() (float64, float64, float64, float64)
- func (_eace *List) Marker() *TextChunk
- func (_adfbc *List) SetIndent(indent float64)
- func (_bfgd *List) SetMargins(left, right, top, bottom float64)
- func (_gfaff *List) Width() float64
- type Margins
- type PageBreak
- type PageFinalizeFunctionArgs
- type PageSize
- type Paragraph
- func (_adfd *Paragraph) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_efdd *Paragraph) GetMargins() (float64, float64, float64, float64)
- func (_eebc *Paragraph) Height() float64
- func (_dgfe *Paragraph) SetAngle(angle float64)
- func (_dbec *Paragraph) SetColor(col Color)
- func (_ebff *Paragraph) SetEnableWrap(enableWrap bool)
- func (_bdebg *Paragraph) SetFont(font *_fee.PdfFont)
- func (_bccgg *Paragraph) SetFontSize(fontSize float64)
- func (_cegca *Paragraph) SetLineHeight(lineheight float64)
- func (_cabf *Paragraph) SetMargins(left, right, top, bottom float64)
- func (_bcabb *Paragraph) SetMaxLines(maxLines int)
- func (_egaga *Paragraph) SetPos(x, y float64)
- func (_baga *Paragraph) SetText(text string)
- func (_aacb *Paragraph) SetTextAlignment(align TextAlignment)
- func (_gcfe *Paragraph) SetWidth(width float64)
- func (_cbcd *Paragraph) Text() string
- func (_dabb *Paragraph) Width() float64
- type PolyBezierCurve
- func (_fdddb *PolyBezierCurve) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_cbaa *PolyBezierCurve) SetBorderColor(color Color)
- func (_cddf *PolyBezierCurve) SetBorderOpacity(opacity float64)
- func (_cbfb *PolyBezierCurve) SetBorderWidth(borderWidth float64)
- func (_gggg *PolyBezierCurve) SetFillColor(color Color)
- func (_cecgf *PolyBezierCurve) SetFillOpacity(opacity float64)
- type Polygon
- func (_agbge *Polygon) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_aebg *Polygon) SetBorderColor(color Color)
- func (_cbff *Polygon) SetBorderOpacity(opacity float64)
- func (_dcfcg *Polygon) SetBorderWidth(borderWidth float64)
- func (_ffce *Polygon) SetFillColor(color Color)
- func (_afcca *Polygon) SetFillOpacity(opacity float64)
- type Polyline
- type Positioning
- type RadialShading
- func (_dbfg *RadialShading) AddColorStop(color Color, point float64)
- func (_ddcgd *RadialShading) AddPatternResource(block *Block) (_gagb _dd.PdfObjectName, _aeeg error)
- func (_gfba *RadialShading) AddShadingResource(block *Block) (_aafdb _dd.PdfObjectName, _fabg error)
- func (_cadd *RadialShading) SetAnchor(anchor AnchorPoint)
- func (_dbdd *RadialShading) SetAntiAlias(enable bool)
- func (_bgaad *RadialShading) SetBackgroundColor(backgroundColor Color)
- func (_bada *RadialShading) SetBoundingBox(x, y, width, height float64)
- func (_becb *RadialShading) SetExtends(start bool, end bool)
- func (_gada *RadialShading) ToPdfShadingPattern() *_fee.PdfShadingPatternType3
- func (_fdda *RadialShading) ToRGB() (float64, float64, float64)
- type Rectangle
- func (_gcgff *Rectangle) BorderColor() Color
- func (_ecgebf *Rectangle) BorderOpacity() float64
- func (_bddf *Rectangle) BorderWidth() float64
- func (_cdbc *Rectangle) FillColor() Color
- func (_adfaf *Rectangle) FillOpacity() float64
- func (_dgeb *Rectangle) FitMode() FitMode
- func (_aebf *Rectangle) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_caaa *Rectangle) GetCoords() (float64, float64)
- func (_edaf *Rectangle) GetMargins() (float64, float64, float64, float64)
- func (_aeed *Rectangle) Height() float64
- func (_dcbf *Rectangle) Positioning() Positioning
- func (_aafd *Rectangle) Scale(xFactor, yFactor float64)
- func (_fccf *Rectangle) ScaleToHeight(h float64)
- func (_bdca *Rectangle) ScaleToWidth(w float64)
- func (_fcca *Rectangle) SetBorderColor(col Color)
- func (_fecb *Rectangle) SetBorderOpacity(opacity float64)
- func (_dfed *Rectangle) SetBorderRadius(topLeft, topRight, bottomLeft, bottomRight float64)
- func (_decc *Rectangle) SetBorderWidth(bw float64)
- func (_agbgb *Rectangle) SetCoords(x, y float64)
- func (_adee *Rectangle) SetFillColor(col Color)
- func (_gbef *Rectangle) SetFillOpacity(opacity float64)
- func (_dbfe *Rectangle) SetFitMode(fitMode FitMode)
- func (_afec *Rectangle) SetHeight(height float64)
- func (_gdag *Rectangle) SetMargins(left, right, top, bottom float64)
- func (_egee *Rectangle) SetPositioning(position Positioning)
- func (_debba *Rectangle) SetWidth(width float64)
- func (_gfeea *Rectangle) Width() float64
- type StyledParagraph
- func (_cfbad *StyledParagraph) AddExternalLink(text, url string) *TextChunk
- func (_eccd *StyledParagraph) AddInternalLink(text string, page int64, x, y, zoom float64) *TextChunk
- func (_gbgdf *StyledParagraph) Append(text string) *TextChunk
- func (_bfdda *StyledParagraph) EnableWordWrap(val bool)
- func (_bcgde *StyledParagraph) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_fbbe *StyledParagraph) GetMargins() (float64, float64, float64, float64)
- func (_fdcd *StyledParagraph) Height() float64
- func (_ffbf *StyledParagraph) Insert(index uint, text string) *TextChunk
- func (_geegb *StyledParagraph) Reset()
- func (_ceaa *StyledParagraph) SetAngle(angle float64)
- func (_eagc *StyledParagraph) SetEnableWrap(enableWrap bool)
- func (_deead *StyledParagraph) SetLineHeight(lineheight float64)
- func (_acggb *StyledParagraph) SetMargins(left, right, top, bottom float64)
- func (_dcfeg *StyledParagraph) SetPos(x, y float64)
- func (_dacgf *StyledParagraph) SetText(text string) *TextChunk
- func (_afdab *StyledParagraph) SetTextAlignment(align TextAlignment)
- func (_gacaf *StyledParagraph) SetTextOverflow(textOverflow TextOverflow)
- func (_edag *StyledParagraph) SetTextVerticalAlignment(align TextVerticalAlignment)
- func (_dddfg *StyledParagraph) SetWidth(width float64)
- func (_agga *StyledParagraph) Width() float64
- type TOC
- func (_egagc *TOC) Add(number, title, page string, level uint) *TOCLine
- func (_egbd *TOC) AddLine(line *TOCLine) *TOCLine
- func (_bccge *TOC) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_eggfd *TOC) Heading() *StyledParagraph
- func (_fdcde *TOC) Lines() []*TOCLine
- func (_bebgf *TOC) SetHeading(text string, style TextStyle)
- func (_gaag *TOC) SetLineLevelOffset(levelOffset float64)
- func (_ddafb *TOC) SetLineMargins(left, right, top, bottom float64)
- func (_dgbfc *TOC) SetLineNumberStyle(style TextStyle)
- func (_gfcb *TOC) SetLinePageStyle(style TextStyle)
- func (_bageg *TOC) SetLineSeparator(separator string)
- func (_ebfdf *TOC) SetLineSeparatorStyle(style TextStyle)
- func (_beefd *TOC) SetLineStyle(style TextStyle)
- func (_ecbcgb *TOC) SetLineTitleStyle(style TextStyle)
- func (_abbbg *TOC) SetShowLinks(showLinks bool)
- type TOCLine
- func (_bfgbaa *TOCLine) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_aceaa *TOCLine) GetMargins() (float64, float64, float64, float64)
- func (_fdebg *TOCLine) Level() uint
- func (_geade *TOCLine) LevelOffset() float64
- func (_gbgfc *TOCLine) Link() (_cfgcf int64, _ccfec, _fdadd float64)
- func (_degcg *TOCLine) SetLevel(level uint)
- func (_acfgd *TOCLine) SetLevelOffset(levelOffset float64)
- func (_bcca *TOCLine) SetLink(page int64, x, y float64)
- func (_faacbe *TOCLine) SetMargins(left, right, top, bottom float64)
- func (_decgb *TOCLine) SetStyle(style TextStyle)
- type Table
- func (_daba *Table) AddSubtable(row, col int, subtable *Table)
- func (_gade *Table) Cols() int
- func (_cdfad *Table) CurCol() int
- func (_bedab *Table) CurRow() int
- func (_cfcff *Table) EnablePageWrap(enable bool)
- func (_agaee *Table) EnableRowWrap(enable bool)
- func (_edge *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
- func (_eeegg *Table) GetMargins() (float64, float64, float64, float64)
- func (_afee *Table) GetRowHeight(row int) (float64, error)
- func (_beecd *Table) Height() float64
- func (_edbd *Table) MultiCell(rowspan, colspan int) *TableCell
- func (_abgad *Table) MultiColCell(colspan int) *TableCell
- func (_aeccg *Table) MultiRowCell(rowspan int) *TableCell
- func (_cfbacb *Table) NewCell() *TableCell
- func (_dgeeb *Table) Rows() int
- func (_bgbc *Table) SetColumnWidths(widths ...float64) error
- func (_dbfa *Table) SetHeaderRows(startRow, endRow int) error
- func (_gafg *Table) SetMargins(left, right, top, bottom float64)
- func (_bfca *Table) SetPos(x, y float64)
- func (_ccef *Table) SetRowHeight(row int, h float64) error
- func (_ddgd *Table) SkipCells(num int)
- func (_acfg *Table) SkipOver(rows, cols int)
- func (_abccg *Table) SkipRows(num int)
- func (_gagaa *Table) Width() float64
- type TableCell
- func (_dafbd *TableCell) GetIndent() float64
- func (_ebaea *TableCell) SetBackgroundColor(col Color)
- func (_gabgc *TableCell) SetBorder(side CellBorderSide, style CellBorderStyle, width float64)
- func (_ccbg *TableCell) SetBorderColor(col Color)
- func (_aacgbc *TableCell) SetBorderLineStyle(style _bg.LineStyle)
- func (_dgfb *TableCell) SetContent(vd VectorDrawable) error
- func (_cbgdf *TableCell) SetHorizontalAlignment(halign CellHorizontalAlignment)
- func (_ffbe *TableCell) SetIndent(indent float64)
- func (_cfgdc *TableCell) SetSideBorderColor(side CellBorderSide, col Color)
- func (_eccba *TableCell) SetSideBorderStyle(side CellBorderSide, style CellBorderStyle)
- func (_dfbdf *TableCell) SetSideBorderWidth(side CellBorderSide, width float64)
- func (_aegfd *TableCell) SetVerticalAlignment(valign CellVerticalAlignment)
- func (_fdbdc *TableCell) Width(ctx DrawContext) float64
- type TemplateOptions
- type TextAlignment
- type TextChunk
- type TextDecorationLineStyle
- type TextOverflow
- type TextRenderingMode
- type TextStyle
- type TextVerticalAlignment
- type UnsupportedRuneError
- type VectorDrawable
Constants ¶
const (
DefaultHorizontalScaling = 100
)
Variables ¶
var ( PageSizeA3 = PageSize{297 * PPMM, 420 * PPMM} PageSizeA4 = PageSize{210 * PPMM, 297 * PPMM} PageSizeA5 = PageSize{148 * PPMM, 210 * PPMM} PageSizeLetter = PageSize{8.5 * PPI, 11 * PPI} PageSizeLegal = PageSize{8.5 * PPI, 14 * PPI} )
var ( ColorBlack = ColorRGBFromArithmetic(0, 0, 0) ColorWhite = ColorRGBFromArithmetic(1, 1, 1) ColorRed = ColorRGBFromArithmetic(1, 0, 0) ColorGreen = ColorRGBFromArithmetic(0, 1, 0) ColorBlue = ColorRGBFromArithmetic(0, 0, 1) ColorYellow = ColorRGBFromArithmetic(1, 1, 0) )
var PPI float64 = 72
var PPMM = float64(72 * 1.0 / 25.4)
Functions ¶
This section is empty.
Types ¶
type AnchorPoint ¶
type AnchorPoint int
AnchorPoint defines anchor point where the center position of the radial gradient would be calculated.
const ( AnchorBottomLeft AnchorPoint = iota AnchorBottomRight AnchorTopLeft AnchorTopRight AnchorCenter AnchorLeft AnchorRight AnchorTop AnchorBottom )
type Background ¶
type Background struct { FillColor Color BorderColor Color BorderSize float64 BorderRadiusTopLeft float64 BorderRadiusTopRight float64 BorderRadiusBottomLeft float64 BorderRadiusBottomRight float64 }
Background contains properties related to the background of a component.
func (*Background) SetBorderRadius ¶
func (_cb *Background) SetBorderRadius(topLeft, topRight, bottomLeft, bottomRight float64)
SetBorderRadius sets the radius of the background corners.
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block contains a portion of PDF Page contents. It has a width and a position and can be placed anywhere on a Page. It can even contain a whole Page, and is used in the creator where each Drawable object can output one or more blocks, each representing content for separate pages (typically needed when Page breaks occur).
func NewBlockFromPage ¶
NewBlockFromPage creates a Block from a PDF Page. Useful for loading template pages as blocks from a PDF document and additional content with the creator.
func (*Block) AddAnnotation ¶
func (_bb *Block) AddAnnotation(annotation *_fee.PdfAnnotation)
AddAnnotation adds an annotation to the current block. The annotation will be added to the page the block will be rendered on.
func (*Block) Draw ¶
Draw draws the drawable d on the block. Note that the drawable must not wrap, i.e. only return one block. Otherwise an error is returned.
func (*Block) DrawTemplate ¶
func (_eed *Block) DrawTemplate(c *Creator, r _fg.Reader, data interface{}, options *TemplateOptions) error
DrawTemplate renders the template provided through the specified reader, using the specified `data` and `options`. Creator templates are first executed as text/template *Template instances, so the specified `data` is inserted within the template. The second phase of processing is actually parsing the template, translating it into creator components and rendering them using the provided options. Both the `data` and `options` parameters can be nil.
func (*Block) DrawWithContext ¶
func (_caa *Block) DrawWithContext(d Drawable, ctx DrawContext) error
DrawWithContext draws the Block using the specified drawing context.
func (*Block) GeneratePageBlocks ¶
func (_fbg *Block) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the block contents on a template Page block. Implements the Drawable interface.
func (*Block) GetMargins ¶
GetMargins returns the Block's margins: left, right, top, bottom.
func (*Block) RotatedSize ¶
RotatedSize returns the width and height of the rotated block.
func (*Block) ScaleToHeight ¶
ScaleToHeight scales the Block to a specified height, maintaining the same aspect ratio.
func (*Block) ScaleToWidth ¶
ScaleToWidth scales the Block to a specified width, maintaining the same aspect ratio.
func (*Block) SetMargins ¶
SetMargins sets the Block's left, right, top, bottom, margins.
type CellBorderSide ¶
type CellBorderSide int
CellBorderSide defines the table cell's border side.
const ( CellBorderSideLeft CellBorderSide = iota CellBorderSideRight CellBorderSideTop CellBorderSideBottom CellBorderSideAll )
type CellBorderStyle ¶
type CellBorderStyle int
CellBorderStyle defines the table cell's border style.
const ( CellBorderStyleNone CellBorderStyle = iota CellBorderStyleSingle CellBorderStyleDouble )
type CellHorizontalAlignment ¶
type CellHorizontalAlignment int
CellHorizontalAlignment defines the table cell's horizontal alignment.
const ( CellHorizontalAlignmentLeft CellHorizontalAlignment = iota CellHorizontalAlignmentCenter CellHorizontalAlignmentRight )
type CellVerticalAlignment ¶
type CellVerticalAlignment int
CellVerticalAlignment defines the table cell's vertical alignment.
const ( CellVerticalAlignmentTop CellVerticalAlignment = iota CellVerticalAlignmentMiddle CellVerticalAlignmentBottom )
type Chapter ¶
type Chapter struct {
// contains filtered or unexported fields
}
Chapter is used to arrange multiple drawables (paragraphs, images, etc) into a single section. The concept is the same as a book or a report chapter.
func (*Chapter) Add ¶
Add adds a new Drawable to the chapter. Currently supported Drawables: - *Paragraph - *StyledParagraph - *Image - *Chart - *Table - *Division - *List - *Rectangle - *Ellipse - *Line - *Block, - *PageBreak - *Chapter
func (*Chapter) GeneratePageBlocks ¶
func (_ggbg *Chapter) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generate the Page blocks. Multiple blocks are generated if the contents wrap over multiple pages.
func (*Chapter) GetHeading ¶
GetHeading returns the chapter heading paragraph. Used to give access to address style: font, sizing etc.
func (*Chapter) GetMargins ¶
GetMargins returns the Chapter's margin: left, right, top, bottom.
func (*Chapter) NewSubchapter ¶
NewSubchapter creates a new child chapter with the specified title.
func (*Chapter) SetIncludeInTOC ¶
SetIncludeInTOC sets a flag to indicate whether or not to include in tOC.
func (*Chapter) SetMargins ¶
SetMargins sets the Chapter margins: left, right, top, bottom. Typically not needed as the creator's page margins are used.
func (*Chapter) SetShowNumbering ¶
SetShowNumbering sets a flag to indicate whether or not to show chapter numbers as part of title.
type Chart ¶
type Chart struct {
// contains filtered or unexported fields
}
Chart represents a chart drawable. It is used to render unichart chart components using a creator instance.
func NewChart ¶
func NewChart(chart _ef.ChartRenderable) *Chart
NewChart creates a new creator drawable based on the provided unichart chart component.
func (*Chart) GeneratePageBlocks ¶
func (_dfgb *Chart) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the chart onto a block.
func (*Chart) GetMargins ¶
GetMargins returns the margins of the chart (left, right, top, bottom).
func (*Chart) SetMargins ¶
SetMargins sets the margins of the chart component.
type Color ¶
Color interface represents colors in the PDF creator.
func ColorCMYKFrom8bit ¶
ColorCMYKFrom8bit creates a Color from c,m,y,k values (0-100). Example:
red := ColorCMYKFrom8Bit(0, 100, 100, 0)
func ColorCMYKFromArithmetic ¶
ColorCMYKFromArithmetic creates a Color from arithmetic color values (0-1). Example:
green := ColorCMYKFromArithmetic(1.0, 0.0, 1.0, 0.0)
func ColorRGBFrom8bit ¶
ColorRGBFrom8bit creates a Color from 8-bit (0-255) r,g,b values. Example:
red := ColorRGBFrom8Bit(255, 0, 0)
func ColorRGBFromArithmetic ¶
ColorRGBFromArithmetic creates a Color from arithmetic color values (0-1). Example:
green := ColorRGBFromArithmetic(0.0, 1.0, 0.0)
func ColorRGBFromHex ¶
ColorRGBFromHex converts color hex code to rgb color for using with creator. NOTE: If there is a problem interpreting the string, then will use black color and log a debug message. Example hex code: #ffffff -> (1,1,1) white.
type ColorPoint ¶
type ColorPoint struct {
// contains filtered or unexported fields
}
ColorPoint is a pair of Color and a relative point where the color would be rendered.
func NewColorPoint ¶
func NewColorPoint(color Color, point float64) *ColorPoint
NewColorPoint creates a new color and point object for use in the gradient rendering process.
type Creator ¶
type Creator struct { // Errors keeps error messages that should not interrupt pdf processing and to be checked later. Errors []error // UnsupportedCharacterReplacement is character that will be used to replace unsupported glyph. // The value will be passed to drawing context. UnsupportedCharacterReplacement rune // Controls whether a table of contents will be generated. AddTOC bool // CustomTOC specifies if the TOC is rendered by the user. // When the `CustomTOC` field is set to `true`, the default TOC component is not rendered. // Instead the TOC is drawn by the user, in the callback provided to // the `Creator.CreateTableOfContents` method. // If `CustomTOC` is set to `false`, the callback provided to // `Creator.CreateTableOfContents` customizes the style of the automatically generated TOC component. CustomTOC bool // Controls whether outlines will be generated. AddOutlines bool // contains filtered or unexported fields }
Creator is a wrapper around functionality for creating PDF reports and/or adding new content onto imported PDF pages, etc.
func (*Creator) AddPage ¶
AddPage adds the specified page to the creator. NOTE: If the page has a Rotate flag, the creator will take care of transforming the contents to maintain the correct orientation.
func (*Creator) Context ¶
func (_fceg *Creator) Context() DrawContext
Context returns the current drawing context.
func (*Creator) CreateFrontPage ¶
func (_gfgg *Creator) CreateFrontPage(genFrontPageFunc func(_dddd FrontpageFunctionArgs))
CreateFrontPage sets a function to generate a front Page.
func (*Creator) CreateTableOfContents ¶
CreateTableOfContents sets a function to generate table of contents.
func (*Creator) Draw ¶
Draw processes the specified Drawable widget and generates blocks that can be rendered to the output document. The generated blocks can span over one or more pages. Additional pages are added if the contents go over the current page. Each generated block is assigned to the creator page it will be rendered to. In order to render the generated blocks to the creator pages, call Finalize, Write or WriteToFile.
func (*Creator) DrawFooter ¶
func (_feea *Creator) DrawFooter(drawFooterFunc func(_fdgb *Block, _cfdff FooterFunctionArgs))
DrawFooter sets a function to draw a footer on created output pages.
func (*Creator) DrawHeader ¶
func (_acf *Creator) DrawHeader(drawHeaderFunc func(_afdb *Block, _ebecd HeaderFunctionArgs))
DrawHeader sets a function to draw a header on created output pages.
func (*Creator) DrawTemplate ¶
func (_fcd *Creator) DrawTemplate(r _fg.Reader, data interface{}, options *TemplateOptions) error
DrawTemplate renders the template provided through the specified reader, using the specified `data` and `options`. Creator templates are first executed as text/template *Template instances, so the specified `data` is inserted within the template. The second phase of processing is actually parsing the template, translating it into creator components and rendering them using the provided options. Both the `data` and `options` parameters can be nil.
func (*Creator) EnableFontSubsetting ¶
EnableFontSubsetting enables font subsetting for `font` when the creator output is written to file. Embeds only the subset of the runes/glyphs that are actually used to display the file. Subsetting can reduce the size of fonts significantly.
func (*Creator) Finalize ¶
Finalize renders all blocks to the creator pages. In addition, it takes care of adding headers and footers, as well as generating the front page, table of contents and outlines. Finalize is automatically called before writing the document out. Calling the method manually can be useful when adding external pages to the creator, using the AddPage method, as it renders all creator blocks to the added pages, without having to write the document out. NOTE: TOC and outlines are generated only if the AddTOC and AddOutlines fields of the creator are set to true (enabled by default). Furthermore, TOCs and outlines without content are skipped. TOC and outline content is added automatically when using the chapter component. TOCs and outlines can also be set externally, using the SetTOC and SetOutlineTree methods. Finalize should only be called once, after all draw calls have taken place, as it will return immediately if the creator instance has been finalized.
func (*Creator) Flip ¶
Flip flips the active page on the specified axes. If `flipH` is true, the page is flipped horizontally. Similarly, if `flipV` is true, the page is flipped vertically. If both are true, the page is flipped both horizontally and vertically. NOTE: the flip transformations are applied when the creator is finalized, which is at write time in most cases.
func (*Creator) GetOptimizer ¶
GetOptimizer returns current PDF optimizer.
func (*Creator) MoveDown ¶
MoveDown moves the drawing context down by relative displacement dy (negative goes up).
func (*Creator) MoveRight ¶
MoveRight moves the drawing context right by relative displacement dx (negative goes left).
func (*Creator) NewChapter ¶
NewChapter creates a new chapter with the specified title as the heading.
func (*Creator) NewCurve ¶
NewCurve returns new instance of Curve between points (x1,y1) and (x2, y2) with control point (cx,cy).
func (*Creator) NewCurvePolygon ¶
func (_fgbb *Creator) NewCurvePolygon(rings [][]_bg.CubicBezierCurve) *CurvePolygon
NewCurvePolygon creates a new curve polygon.
func (*Creator) NewDivision ¶
NewDivision returns a new Division container component.
func (*Creator) NewEllipse ¶
NewEllipse creates a new ellipse with the center at (`xc`, `yc`), having the specified width and height. NOTE: In relative positioning mode, `xc` and `yc` are calculated using the current context. Furthermore, when the fit mode is set to fill the available space, the ellipse is scaled so that it occupies the entire context width while maintaining the original aspect ratio.
func (*Creator) NewFilledCurve ¶
func (_ebdg *Creator) NewFilledCurve() *FilledCurve
NewFilledCurve returns a instance of filled curve.
func (*Creator) NewImageFromData ¶
NewImageFromData creates an Image from image data.
func (*Creator) NewImageFromFile ¶
NewImageFromFile creates an Image from a file.
func (*Creator) NewImageFromGoImage ¶
NewImageFromGoImage creates an Image from a go image.Image data structure.
func (*Creator) NewInvoice ¶
NewInvoice returns an instance of an empty invoice.
func (*Creator) NewLine ¶
NewLine creates a new line between (x1, y1) to (x2, y2), using default attributes. NOTE: In relative positioning mode, `x1` and `y1` are calculated using the current context and `x2`, `y2` are used only to calculate the position of the second point in relation to the first one (used just as a measurement of size). Furthermore, when the fit mode is set to fill the context width, `x2` is set to the right edge coordinate of the context.
func (*Creator) NewLinearGradientColor ¶
func (_bfba *Creator) NewLinearGradientColor(colorPoints []*ColorPoint) *LinearShading
NewLinearGradientColor creates a linear gradient color that could act as a color in other components.
func (*Creator) NewPageBreak ¶
NewPageBreak create a new page break.
func (*Creator) NewParagraph ¶
NewParagraph creates a new text paragraph. Default attributes: Font: Helvetica, Font size: 10 Encoding: WinAnsiEncoding Wrap: enabled Text color: black
func (*Creator) NewPolyBezierCurve ¶
func (_ggd *Creator) NewPolyBezierCurve(curves []_bg.CubicBezierCurve) *PolyBezierCurve
NewPolyBezierCurve creates a new composite Bezier (polybezier) curve.
func (*Creator) NewPolygon ¶
NewPolygon creates a new polygon.
func (*Creator) NewPolyline ¶
NewPolyline creates a new polyline.
func (*Creator) NewRadialGradientColor ¶
func (_dafd *Creator) NewRadialGradientColor(x float64, y float64, innerRadius float64, outerRadius float64, colorPoints []*ColorPoint) *RadialShading
NewRadialGradientColor creates a radial gradient color that could act as a color in other componenents. Note: The innerRadius must be smaller than outerRadius for the circle to render properly.
func (*Creator) NewRectangle ¶
NewRectangle creates a new rectangle with the left corner at (`x`, `y`), having the specified width and height. NOTE: In relative positioning mode, `x` and `y` are calculated using the current context. Furthermore, when the fit mode is set to fill the available space, the rectangle is scaled so that it occupies the entire context width while maintaining the original aspect ratio.
func (*Creator) NewStyledParagraph ¶
func (_dabcd *Creator) NewStyledParagraph() *StyledParagraph
NewStyledParagraph creates a new styled paragraph. Default attributes: Font: Helvetica, Font size: 10 Encoding: WinAnsiEncoding Wrap: enabled Text color: black
func (*Creator) NewStyledTOCLine ¶
func (_ffb *Creator) NewStyledTOCLine(number, title, page TextChunk, level uint, style TextStyle) *TOCLine
NewStyledTOCLine creates a new table of contents line with the provided style.
func (*Creator) NewTOCLine ¶
NewTOCLine creates a new table of contents line with the default style.
func (*Creator) NewTextStyle ¶
NewTextStyle creates a new text style object which can be used to style chunks of text. Default attributes: Font: Helvetica Font size: 10 Encoding: WinAnsiEncoding Text color: black
func (*Creator) PageFinalize ¶
func (_aaga *Creator) PageFinalize(pageFinalizeFunc func(_eagbd PageFinalizeFunctionArgs) error)
PageFinalize sets a function to be called for each page before finalization (i.e. the last stage of page processing before they get written out). The callback function allows final touch-ups for each page, and it provides information that might not be known at other stages of designing the document (e.g. the total number of pages). Unlike the header/footer functions, which are limited to the top/bottom margins of the page, the finalize function can be used draw components anywhere on the current page.
func (*Creator) RotateDeg ¶
RotateDeg rotates the current active page by angle degrees. An error is returned on failure, which can be if there is no currently active page, or the angleDeg is not a multiple of 90 degrees.
func (*Creator) SetForms ¶
func (_dfde *Creator) SetForms(form *_fee.PdfAcroForm) error
SetForms adds an Acroform to a PDF file. Sets the specified form for writing.
func (*Creator) SetOptimizer ¶
SetOptimizer sets the optimizer to optimize PDF before writing.
func (*Creator) SetOutlineTree ¶
func (_ddfc *Creator) SetOutlineTree(outlineTree *_fee.PdfOutlineTreeNode)
SetOutlineTree adds the specified outline tree to the PDF file generated by the creator. Adding an external outline tree disables the automatic generation of outlines done by the creator for the relevant components.
func (*Creator) SetPageLabels ¶
SetPageLabels adds the specified page labels to the PDF file generated by the creator. See section 12.4.2 "Page Labels" (p. 382 PDF32000_2008). NOTE: for existing PDF files, the page label ranges object can be obtained using the model.PDFReader's GetPageLabels method.
func (*Creator) SetPageMargins ¶
SetPageMargins sets the page margins: left, right, top, bottom. The default page margins are 10% of document width.
func (*Creator) SetPageSize ¶
SetPageSize sets the Creator's page size. Pages that are added after this will be created with this Page size. Does not affect pages already created.
Common page sizes are defined as constants. Examples: 1. c.SetPageSize(creator.PageSizeA4) 2. c.SetPageSize(creator.PageSizeA3) 3. c.SetPageSize(creator.PageSizeLegal) 4. c.SetPageSize(creator.PageSizeLetter)
For custom sizes: Use the PPMM (points per mm) and PPI (points per inch) when defining those based on physical page sizes:
Examples: 1. 10x15 sq. mm: SetPageSize(PageSize{10*creator.PPMM, 15*creator.PPMM}) where PPMM is points per mm. 2. 3x2 sq. inches: SetPageSize(PageSize{3*creator.PPI, 2*creator.PPI}) where PPI is points per inch.
func (*Creator) SetPdfWriterAccessFunc ¶
SetPdfWriterAccessFunc sets a PdfWriter access function/hook. Exposes the PdfWriter just prior to writing the PDF. Can be used to encrypt the output PDF, etc.
Example of encrypting with a user/owner password "password" Prior to calling c.WriteFile():
c.SetPdfWriterAccessFunc(func(w *model.PdfWriter) error { userPass := []byte("password") ownerPass := []byte("password") err := w.Encrypt(userPass, ownerPass, nil) return err })
func (*Creator) SetTOC ¶
SetTOC sets the table of content component of the creator. This method should be used when building a custom table of contents.
func (*Creator) WriteToFile ¶
WriteToFile writes the Creator output to file specified by path.
type Curve ¶
type Curve struct {
// contains filtered or unexported fields
}
Curve represents a cubic Bezier curve with a control point.
func (*Curve) GeneratePageBlocks ¶
func (_ddcb *Curve) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the curve onto page blocks.
type CurvePolygon ¶
type CurvePolygon struct {
// contains filtered or unexported fields
}
CurvePolygon represents a curve polygon shape. Implements the Drawable interface and can be drawn on PDF using the Creator.
func (*CurvePolygon) GeneratePageBlocks ¶
func (_gcgf *CurvePolygon) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the composite curve polygon on a new block representing the page. Implements the Drawable interface.
func (*CurvePolygon) SetBorderColor ¶
func (_gecb *CurvePolygon) SetBorderColor(color Color)
SetBorderColor sets the border color.
func (*CurvePolygon) SetBorderOpacity ¶
func (_addc *CurvePolygon) SetBorderOpacity(opacity float64)
SetBorderOpacity sets the border opacity.
func (*CurvePolygon) SetBorderWidth ¶
func (_fcacb *CurvePolygon) SetBorderWidth(borderWidth float64)
SetBorderWidth sets the border width.
func (*CurvePolygon) SetFillColor ¶
func (_cbgb *CurvePolygon) SetFillColor(color Color)
SetFillColor sets the fill color.
func (*CurvePolygon) SetFillOpacity ¶
func (_efgc *CurvePolygon) SetFillOpacity(opacity float64)
SetFillOpacity sets the fill opacity.
type Division ¶
type Division struct {
// contains filtered or unexported fields
}
Division is a container component which can wrap across multiple pages. Currently supported drawable components: - *Paragraph - *StyledParagraph - *Image - *Chart
The component stacking behavior is vertical, where the drawables are drawn on top of each other.
func (*Division) Add ¶
func (_gag *Division) Add(d VectorDrawable) error
Add adds a VectorDrawable to the Division container. Currently supported VectorDrawables: - *Paragraph - *StyledParagraph - *Image - *Chart - *Rectangle - *Ellipse - *Line - *Table - *Division - *List
func (*Division) EnablePageWrap ¶
EnablePageWrap controls whether the division is wrapped across pages. If disabled, the division is moved in its entirety on a new page, if it does not fit in the available height. By default, page wrapping is enabled. If the height of the division is larger than an entire page, wrapping is enabled automatically in order to avoid unwanted behavior. Currently, page wrapping can only be disabled for vertical divisions.
func (*Division) GeneratePageBlocks ¶
func (_egad *Division) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generates the page blocks for the Division component. Multiple blocks are generated if the contents wrap over multiple pages.
func (*Division) Height ¶
Height returns the height of the division, assuming all components are stacked on top of each other.
func (*Division) SetBackground ¶
func (_gccde *Division) SetBackground(background *Background)
SetBackground sets the background properties of the component.
func (*Division) SetMargins ¶
SetMargins sets the margins of the component. The margins are applied around the division.
func (*Division) SetPadding ¶
SetPadding sets the padding of the component. The padding represents inner margins which are applied around the contents of the division. The background of the component is not affected by its padding.
type DrawContext ¶
type DrawContext struct { // Current page number. Page int // Current position. In a relative positioning mode, a drawable will be placed at these coordinates. X, Y float64 // Context dimensions. Available width and height (on current page). Width, Height float64 // Page Margins. Margins Margins // Absolute Page size, widths and height. PageWidth float64 PageHeight float64 // Controls whether the components are stacked horizontally Inline bool // contains filtered or unexported fields }
DrawContext defines the drawing context. The DrawContext is continuously used and updated when drawing the page contents in relative mode. Keeps track of current X, Y position, available height as well as other page parameters such as margins and dimensions.
type Drawable ¶
type Drawable interface { // GeneratePageBlocks draw onto blocks representing Page contents. As the content can wrap over many pages, multiple // templates are returned, one per Page. The function also takes a draw context containing information // where to draw (if relative positioning) and the available height to draw on accounting for Margins etc. GeneratePageBlocks(_eeed DrawContext) ([]*Block, DrawContext, error) }
Drawable is a widget that can be used to draw with the Creator.
type Ellipse ¶
type Ellipse struct {
// contains filtered or unexported fields
}
Ellipse defines an ellipse with a center at (xc,yc) and a specified width and height. The ellipse can have a colored fill and/or border with a specified width. Implements the Drawable interface and can be drawn on PDF using the Creator.
func (*Ellipse) BorderColor ¶
BorderColor returns the border color of the ellipse.
func (*Ellipse) BorderOpacity ¶
BorderOpacity returns the border opacity of the ellipse (0-1).
func (*Ellipse) BorderWidth ¶
BorderWidth returns the border width of the ellipse.
func (*Ellipse) FillOpacity ¶
FillOpacity returns the fill opacity of the ellipse (0-1).
func (*Ellipse) GeneratePageBlocks ¶
func (_dbdb *Ellipse) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the ellipse on a new block representing the page.
func (*Ellipse) GetMargins ¶
GetMargins returns the margins of the ellipse: left, right, top, bottom.
func (*Ellipse) Positioning ¶
func (_ecae *Ellipse) Positioning() Positioning
Positioning returns the type of positioning the ellipse is set to use.
func (*Ellipse) ScaleToHeight ¶
ScaleToHeight scales the ellipse to the specified height. The width of the ellipse is scaled so that the aspect ratio is maintained.
func (*Ellipse) ScaleToWidth ¶
ScaleToWidth scales the ellipse to the specified width. The height of the ellipse is scaled so that the aspect ratio is maintained.
func (*Ellipse) SetBorderColor ¶
SetBorderColor sets the border color of the ellipse.
func (*Ellipse) SetBorderOpacity ¶
SetBorderOpacity sets the border opacity of the ellipse.
func (*Ellipse) SetBorderWidth ¶
SetBorderWidth sets the border width of the ellipse.
func (*Ellipse) SetFillColor ¶
SetFillColor sets the fill color of the ellipse.
func (*Ellipse) SetFillOpacity ¶
SetFillOpacity sets the fill opacity of the ellipse.
func (*Ellipse) SetFitMode ¶
SetFitMode sets the fit mode of the ellipse. NOTE: The fit mode is only applied if relative positioning is used.
func (*Ellipse) SetMargins ¶
SetMargins sets the margins of the ellipse. NOTE: ellipse margins are only applied if relative positioning is used.
func (*Ellipse) SetPositioning ¶
func (_defd *Ellipse) SetPositioning(position Positioning)
SetPositioning sets the positioning of the ellipse (absolute or relative).
type FilledCurve ¶
type FilledCurve struct { FillEnabled bool BorderEnabled bool BorderWidth float64 // contains filtered or unexported fields }
FilledCurve represents a closed path of Bezier curves with a border and fill.
func (*FilledCurve) AppendCurve ¶
func (_egdc *FilledCurve) AppendCurve(curve _bg.CubicBezierCurve) *FilledCurve
AppendCurve appends a Bezier curve to the filled curve.
func (*FilledCurve) GeneratePageBlocks ¶
func (_eddf *FilledCurve) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the filled curve on page blocks.
func (*FilledCurve) SetBorderColor ¶
func (_dfec *FilledCurve) SetBorderColor(color Color)
SetBorderColor sets the border color for the path.
func (*FilledCurve) SetFillColor ¶
func (_fae *FilledCurve) SetFillColor(color Color)
SetFillColor sets the fill color for the path.
type FooterFunctionArgs ¶
type FooterFunctionArgs struct {}
FooterFunctionArgs holds the input arguments to a footer drawing function. It is designed as a struct, so additional parameters can be added in the future with backwards compatibility.
type FrontpageFunctionArgs ¶
FrontpageFunctionArgs holds the input arguments to a front page drawing function. It is designed as a struct, so additional parameters can be added in the future with backwards compatibility.
type GraphicSVG ¶
type GraphicSVG struct {
// contains filtered or unexported fields
}
GraphicSVG represents a drawable graphic SVG. It is used to render the graphic SVG components using a creator instance.
func NewGraphicSVGFromFile ¶
func NewGraphicSVGFromFile(path string) (*GraphicSVG, error)
NewGraphicSVGFromFile creates a graphic SVG from a file.
func NewGraphicSVGFromString ¶
func NewGraphicSVGFromString(svgStr string) (*GraphicSVG, error)
NewGraphicSVGFromString creates a graphic SVG from a SVG string.
func (*GraphicSVG) GeneratePageBlocks ¶
func (_eedbb *GraphicSVG) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draw graphic svg into block.
func (*GraphicSVG) GetMargins ¶
func (_ggdb *GraphicSVG) GetMargins() (float64, float64, float64, float64)
GetMargins returns the margins of the graphic svg (left, right, top, bottom).
func (*GraphicSVG) Height ¶
func (_bfcb *GraphicSVG) Height() float64
Height returns the height of the graphic svg.
func (*GraphicSVG) Scale ¶
func (_fdbg *GraphicSVG) Scale(xFactor, yFactor float64)
Scale sets the scale ratio with `X` factor and `Y` factor for the graphic svg.
func (*GraphicSVG) ScaleToHeight ¶
func (_cfec *GraphicSVG) ScaleToHeight(h float64)
ScaleToHeight sets the graphic svg scaling factor with the given height.
func (*GraphicSVG) ScaleToWidth ¶
func (_gaff *GraphicSVG) ScaleToWidth(w float64)
ScaleToWidth sets the graphic svg scaling factor with the given width.
func (*GraphicSVG) SetMargins ¶
func (_ecdea *GraphicSVG) SetMargins(left, right, top, bottom float64)
SetMargins sets the margins of the graphic svg component.
func (*GraphicSVG) SetPos ¶
func (_bbgcb *GraphicSVG) SetPos(x, y float64)
SetPos sets the position of the graphic svg to the specified coordinates. This method sets the graphic svg to use absolute positioning.
func (*GraphicSVG) Width ¶
func (_ddca *GraphicSVG) Width() float64
Width returns the width of the graphic svg.
type HeaderFunctionArgs ¶
HeaderFunctionArgs holds the input arguments to a header drawing function. It is designed as a struct, so additional parameters can be added in the future with backwards compatibility.
type HorizontalAlignment ¶
type HorizontalAlignment int
HorizontalAlignment represents the horizontal alignment of components within a page.
const ( HorizontalAlignmentLeft HorizontalAlignment = iota HorizontalAlignmentCenter HorizontalAlignmentRight )
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
The Image type is used to draw an image onto PDF.
func (*Image) ConvertToBinary ¶
ConvertToBinary converts current image data into binary (Bi-level image) format. If provided image is RGB or GrayScale the function converts it into binary image using histogram auto threshold method.
func (*Image) GeneratePageBlocks ¶
func (_adbga *Image) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generate the Page blocks. Draws the Image on a block, implementing the Drawable interface.
func (*Image) GetHorizontalAlignment ¶
func (_ffa *Image) GetHorizontalAlignment() HorizontalAlignment
GetHorizontalAlignment returns the horizontal alignment of the image.
func (*Image) GetMargins ¶
GetMargins returns the Image's margins: left, right, top, bottom.
func (*Image) ScaleToHeight ¶
ScaleToHeight scale Image to a specified height h, maintaining the aspect ratio.
func (*Image) ScaleToWidth ¶
ScaleToWidth scale Image to a specified width w, maintaining the aspect ratio.
func (*Image) SetEncoder ¶
func (_daee *Image) SetEncoder(encoder _dd.StreamEncoder)
SetEncoder sets the encoding/compression mechanism for the image.
func (*Image) SetFitMode ¶
SetFitMode sets the fit mode of the image. NOTE: The fit mode is only applied if relative positioning is used.
func (*Image) SetHorizontalAlignment ¶
func (_baff *Image) SetHorizontalAlignment(alignment HorizontalAlignment)
SetHorizontalAlignment sets the horizontal alignment of the image.
func (*Image) SetMargins ¶
SetMargins sets the margins for the Image (in relative mode): left, right, top, bottom.
func (*Image) SetOpacity ¶
SetOpacity sets opacity for Image.
type Invoice ¶
type Invoice struct {
// contains filtered or unexported fields
}
Invoice represents a configurable invoice template.
func (*Invoice) AddInfo ¶
func (_gefe *Invoice) AddInfo(description, value string) (*InvoiceCell, *InvoiceCell)
AddInfo is used to append a piece of invoice information in the template information table.
func (*Invoice) AddLine ¶
func (_dcef *Invoice) AddLine(values ...string) []*InvoiceCell
AddLine appends a new line to the invoice line items table.
func (*Invoice) AddSection ¶
AddSection adds a new content section at the end of the invoice.
func (*Invoice) AddTotalLine ¶
func (_afcc *Invoice) AddTotalLine(desc, value string) (*InvoiceCell, *InvoiceCell)
AddTotalLine adds a new line in the invoice totals table.
func (*Invoice) AddressHeadingStyle ¶
AddressHeadingStyle returns the style properties used to render the heading of the invoice address sections.
func (*Invoice) AddressStyle ¶
AddressStyle returns the style properties used to render the content of the invoice address sections.
func (*Invoice) AppendColumn ¶
func (_gecbf *Invoice) AppendColumn(description string) *InvoiceCell
AppendColumn appends a column to the line items table.
func (*Invoice) BuyerAddress ¶
func (_ebad *Invoice) BuyerAddress() *InvoiceAddress
BuyerAddress returns the buyer address used in the invoice template.
func (*Invoice) Columns ¶
func (_bebgb *Invoice) Columns() []*InvoiceCell
Columns returns all the columns in the invoice line items table.
func (*Invoice) Date ¶
func (_abgc *Invoice) Date() (*InvoiceCell, *InvoiceCell)
Date returns the invoice date description and value cells. The returned values can be used to customize the styles of the cells.
func (*Invoice) DueDate ¶
func (_bace *Invoice) DueDate() (*InvoiceCell, *InvoiceCell)
DueDate returns the invoice due date description and value cells. The returned values can be used to customize the styles of the cells.
func (*Invoice) GeneratePageBlocks ¶
func (_dfgdf *Invoice) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generate the Page blocks. Multiple blocks are generated if the contents wrap over multiple pages.
func (*Invoice) InfoLines ¶
func (_adea *Invoice) InfoLines() [][2]*InvoiceCell
InfoLines returns all the rows in the invoice information table as description-value cell pairs.
func (*Invoice) InsertColumn ¶
func (_agdd *Invoice) InsertColumn(index uint, description string) *InvoiceCell
InsertColumn inserts a column in the line items table at the specified index.
func (*Invoice) Lines ¶
func (_cbag *Invoice) Lines() [][]*InvoiceCell
Lines returns all the rows of the invoice line items table.
func (*Invoice) NewCell ¶
func (_adccb *Invoice) NewCell(value string) *InvoiceCell
NewCell returns a new invoice table cell.
func (*Invoice) NewCellProps ¶
func (_faacb *Invoice) NewCellProps() InvoiceCellProps
NewCellProps returns the default properties of an invoice cell.
func (*Invoice) NewColumn ¶
func (_fed *Invoice) NewColumn(description string) *InvoiceCell
NewColumn returns a new column for the line items invoice table.
func (*Invoice) NoteHeadingStyle ¶
NoteHeadingStyle returns the style properties used to render the heading of the invoice note sections.
func (*Invoice) NoteStyle ¶
NoteStyle returns the style properties used to render the content of the invoice note sections.
func (*Invoice) Number ¶
func (_efcc *Invoice) Number() (*InvoiceCell, *InvoiceCell)
Number returns the invoice number description and value cells. The returned values can be used to customize the styles of the cells.
func (*Invoice) Sections ¶
Sections returns the custom content sections of the invoice as title-content pairs.
func (*Invoice) SellerAddress ¶
func (_cfdc *Invoice) SellerAddress() *InvoiceAddress
SellerAddress returns the seller address used in the invoice template.
func (*Invoice) SetAddressHeadingStyle ¶
SetAddressHeadingStyle sets the style properties used to render the heading of the invoice address sections.
func (*Invoice) SetAddressStyle ¶
SetAddressStyle sets the style properties used to render the content of the invoice address sections.
func (*Invoice) SetBuyerAddress ¶
func (_bfddf *Invoice) SetBuyerAddress(address *InvoiceAddress)
SetBuyerAddress sets the buyer address of the invoice.
func (*Invoice) SetColumns ¶
func (_gacde *Invoice) SetColumns(cols []*InvoiceCell)
SetColumns overwrites any columns in the line items table. This should be called before AddLine.
func (*Invoice) SetDate ¶
func (_fdce *Invoice) SetDate(date string) (*InvoiceCell, *InvoiceCell)
SetDate sets the date of the invoice.
func (*Invoice) SetDueDate ¶
func (_cbfg *Invoice) SetDueDate(dueDate string) (*InvoiceCell, *InvoiceCell)
SetDueDate sets the due date of the invoice.
func (*Invoice) SetNoteHeadingStyle ¶
SetNoteHeadingStyle sets the style properties used to render the heading of the invoice note sections.
func (*Invoice) SetNoteStyle ¶
SetNoteStyle sets the style properties used to render the content of the invoice note sections.
func (*Invoice) SetNumber ¶
func (_bcdbf *Invoice) SetNumber(number string) (*InvoiceCell, *InvoiceCell)
SetNumber sets the number of the invoice.
func (*Invoice) SetSellerAddress ¶
func (_beedcc *Invoice) SetSellerAddress(address *InvoiceAddress)
SetSellerAddress sets the seller address of the invoice.
func (*Invoice) SetSubtotal ¶
SetSubtotal sets the subtotal of the invoice.
func (*Invoice) SetTitleStyle ¶
SetTitleStyle sets the style properties of the invoice title.
func (*Invoice) Subtotal ¶
func (_fgce *Invoice) Subtotal() (*InvoiceCell, *InvoiceCell)
Subtotal returns the invoice subtotal description and value cells. The returned values can be used to customize the styles of the cells.
func (*Invoice) Terms ¶
Terms returns the terms and conditions section of the invoice as a title-content pair.
func (*Invoice) TitleStyle ¶
TitleStyle returns the style properties used to render the invoice title.
func (*Invoice) Total ¶
func (_afae *Invoice) Total() (*InvoiceCell, *InvoiceCell)
Total returns the invoice total description and value cells. The returned values can be used to customize the styles of the cells.
func (*Invoice) TotalLines ¶
func (_bedg *Invoice) TotalLines() [][2]*InvoiceCell
TotalLines returns all the rows in the invoice totals table as description-value cell pairs.
type InvoiceAddress ¶
type InvoiceAddress struct { Heading string Name string Street string Street2 string Zip string City string State string Country string Phone string Email string // Separator defines the separator between different address components, // such as the city, state and zip code. It defaults to ", " when the // field is an empty string. Separator string // If enabled, the Phone field label (`Phone: `) is not displayed. HidePhoneLabel bool // If enabled, the Email field label (`Email: `) is not displayed. HideEmailLabel bool }
InvoiceAddress contains contact information that can be displayed in an invoice. It is used for the seller and buyer information in the invoice template.
type InvoiceCell ¶
type InvoiceCell struct { InvoiceCellProps Value string }
InvoiceCell represents any cell belonging to a table from the invoice template. The main tables are the invoice information table, the line items table and totals table. Contains the text value of the cell and the style properties of the cell.
type InvoiceCellProps ¶
type InvoiceCellProps struct { TextStyle TextStyle Alignment CellHorizontalAlignment BackgroundColor Color BorderColor Color BorderWidth float64 BorderSides []CellBorderSide }
InvoiceCellProps holds all style properties for an invoice cell.
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line defines a line between point 1 (X1, Y1) and point 2 (X2, Y2). The line width, color, style (solid or dashed) and opacity can be configured. Implements the Drawable interface.
func (*Line) DashPattern ¶
DashPattern returns the dash pattern of the line.
func (*Line) GeneratePageBlocks ¶
func (_adfbb *Line) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the line on a new block representing the page. Implements the Drawable interface.
func (*Line) GetMargins ¶
GetMargins returns the margins of the line: left, right, top, bottom.
func (*Line) Positioning ¶
func (_fddb *Line) Positioning() Positioning
Positioning returns the type of positioning the line is set to use.
func (*Line) SetColor ¶
SetColor sets the line color. Use ColorRGBFromHex, ColorRGBFrom8bit or ColorRGBFromArithmetic to create the color object.
func (*Line) SetDashPattern ¶
SetDashPattern sets the dash pattern of the line. NOTE: the dash pattern is taken into account only if the style of the line is set to dashed.
func (*Line) SetFitMode ¶
SetFitMode sets the fit mode of the line. NOTE: The fit mode is only applied if relative positioning is used.
func (*Line) SetLineWidth ¶
SetLineWidth sets the line width.
func (*Line) SetMargins ¶
SetMargins sets the margins of the line. NOTE: line margins are only applied if relative positioning is used.
func (*Line) SetOpacity ¶
SetOpacity sets the opacity of the line (0-1).
func (*Line) SetPositioning ¶
func (_bccg *Line) SetPositioning(positioning Positioning)
SetPositioning sets the positioning of the line (absolute or relative).
type LinearShading ¶
type LinearShading struct {
// contains filtered or unexported fields
}
LinearShading holds data for rendering a linear shading gradient.
func (*LinearShading) AddColorStop ¶
func (_dggd *LinearShading) AddColorStop(color Color, point float64)
AddColorStop add color stop info for rendering gradient color.
func (*LinearShading) AddPatternResource ¶
func (_addb *LinearShading) AddPatternResource(block *Block) (_cfcce _dd.PdfObjectName, _adae error)
AddPatternResource adds pattern dictionary inside the resources dictionary.
func (*LinearShading) AddShadingResource ¶
func (_fdbbf *LinearShading) AddShadingResource(block *Block) (_dgfef _dd.PdfObjectName, _dged error)
AddShadingResource adds shading dictionary inside the resources dictionary.
func (*LinearShading) SetAngle ¶
func (_dacg *LinearShading) SetAngle(angle float64)
SetAngle would set the angle at which the gradient is rendered.
The default angle would be 0 where the gradient would be rendered from left to right side.
func (*LinearShading) SetAntiAlias ¶
func (_acacc *LinearShading) SetAntiAlias(enable bool)
SetAntiAlias enables anti alias config.
Anti alias is disabled by default.
func (*LinearShading) SetBackgroundColor ¶
func (_eddfc *LinearShading) SetBackgroundColor(backgroundColor Color)
SetBackgroundColor set background color of the shading area.
By default the background color is set to white.
func (*LinearShading) SetBoundingBox ¶
func (_dede *LinearShading) SetBoundingBox(x, y, width, height float64)
SetBoundingBox set gradient color bounding box where the gradient would be rendered.
func (*LinearShading) SetExtends ¶
func (_gcab *LinearShading) SetExtends(start bool, end bool)
SetExtends specifies whether ot extend the shading beyond the starting and ending points.
Text extends is set to `[]bool{false, false}` by default.
func (*LinearShading) ToPdfShadingPattern ¶
func (_bcfe *LinearShading) ToPdfShadingPattern() *_fee.PdfShadingPatternType2
ToPdfShadingPattern generates a new model.PdfShadingPatternType2 object.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List represents a list of items. The representation of a list item is as follows:
[marker] [content]
e.g.: • This is the content of the item. The supported components to add content to list items are: - Paragraph - StyledParagraph - List
func (*List) Add ¶
func (_abca *List) Add(item VectorDrawable) (*TextChunk, error)
Add appends a new item to the list. The supported components are: *Paragraph, *StyledParagraph, *Division, *Image, *Table, and *List. Returns the marker used for the newly added item. The returned marker object can be used to change the text and style of the marker for the current item.
func (*List) AddTextItem ¶
func (_acagc *List) AddTextItem(text string) (*StyledParagraph, *TextChunk, error)
AddTextItem appends a new item with the specified text to the list. The method creates a styled paragraph with the specified text and returns it so that the item style can be customized. The method also returns the marker used for the newly added item. The marker object can be used to change the text and style of the marker for the current item.
func (*List) GeneratePageBlocks ¶
func (_aaed *List) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generate the Page blocks. Multiple blocks are generated if the contents wrap over multiple pages.
func (*List) Marker ¶
Marker returns the marker used for the list items. The marker instance can be used the change the text and the style of newly added list items.
func (*List) SetMargins ¶
SetMargins sets the margins of the paragraph.
type Margins ¶
Margins represents page margins or margins around an element.
func (*Margins) Horizontal ¶
Horizontal returns total horizontal (left + right) margin.
type PageBreak ¶
type PageBreak struct{}
PageBreak represents a page break for a chapter.
func (*PageBreak) GeneratePageBlocks ¶
func (_gaccf *PageBreak) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generates a page break block.
type PageFinalizeFunctionArgs ¶
type PageFinalizeFunctionArgs struct { PageNum int PageWidth float64 PageHeight float64 TOCPages int TotalPages int }
PageFinalizeFunctionArgs holds the input arguments provided to the page finalize callback function which can be set using Creator.PageFinalize.
type PageSize ¶
type PageSize [2]float64
PageSize represents the page size as a 2 element array representing the width and height in PDF document units (points).
type Paragraph ¶
type Paragraph struct {
// contains filtered or unexported fields
}
Paragraph represents text drawn with a specified font and can wrap across lines and pages. By default it occupies the available width in the drawing context.
func (*Paragraph) GeneratePageBlocks ¶
func (_adfd *Paragraph) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generates the page blocks. Multiple blocks are generated if the contents wrap over multiple pages. Implements the Drawable interface.
func (*Paragraph) GetMargins ¶
GetMargins returns the Paragraph's margins: left, right, top, bottom.
func (*Paragraph) Height ¶
Height returns the height of the Paragraph. The height is calculated based on the input text and how it is wrapped within the container. Does not include Margins.
func (*Paragraph) SetColor ¶
SetColor sets the color of the Paragraph text.
Example:
p := NewParagraph("Red paragraph") // Set to red color with a hex code: p.SetColor(creator.ColorRGBFromHex("#ff0000"))
Make Paragraph green with 8-bit rgb values (0-255 each component) p.SetColor(creator.ColorRGBFrom8bit(0, 255, 0)
Make Paragraph blue with arithmetic (0-1) rgb components. p.SetColor(creator.ColorRGBFromArithmetic(0, 0, 1.0)
func (*Paragraph) SetEnableWrap ¶
SetEnableWrap sets the line wrapping enabled flag.
func (*Paragraph) SetFontSize ¶
SetFontSize sets the font size in document units (points).
func (*Paragraph) SetLineHeight ¶
SetLineHeight sets the line height (1.0 default).
func (*Paragraph) SetMargins ¶
SetMargins sets the Paragraph's margins.
func (*Paragraph) SetMaxLines ¶
SetMaxLines sets the maximum number of lines before the paragraph text is truncated.
func (*Paragraph) SetTextAlignment ¶
func (_aacb *Paragraph) SetTextAlignment(align TextAlignment)
SetTextAlignment sets the horizontal alignment of the text within the space provided.
func (*Paragraph) SetWidth ¶
SetWidth sets the the Paragraph width. This is essentially the wrapping width, i.e. the width the text can extend to prior to wrapping over to next line.
type PolyBezierCurve ¶
type PolyBezierCurve struct {
// contains filtered or unexported fields
}
PolyBezierCurve represents a composite curve that is the result of joining multiple cubic Bezier curves. Implements the Drawable interface and can be drawn on PDF using the Creator.
func (*PolyBezierCurve) GeneratePageBlocks ¶
func (_fdddb *PolyBezierCurve) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the composite Bezier curve on a new block representing the page. Implements the Drawable interface.
func (*PolyBezierCurve) SetBorderColor ¶
func (_cbaa *PolyBezierCurve) SetBorderColor(color Color)
SetBorderColor sets the border color.
func (*PolyBezierCurve) SetBorderOpacity ¶
func (_cddf *PolyBezierCurve) SetBorderOpacity(opacity float64)
SetBorderOpacity sets the border opacity.
func (*PolyBezierCurve) SetBorderWidth ¶
func (_cbfb *PolyBezierCurve) SetBorderWidth(borderWidth float64)
SetBorderWidth sets the border width.
func (*PolyBezierCurve) SetFillColor ¶
func (_gggg *PolyBezierCurve) SetFillColor(color Color)
SetFillColor sets the fill color.
func (*PolyBezierCurve) SetFillOpacity ¶
func (_cecgf *PolyBezierCurve) SetFillOpacity(opacity float64)
SetFillOpacity sets the fill opacity.
type Polygon ¶
type Polygon struct {
// contains filtered or unexported fields
}
Polygon represents a polygon shape. Implements the Drawable interface and can be drawn on PDF using the Creator.
func (*Polygon) GeneratePageBlocks ¶
func (_agbge *Polygon) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the polygon on a new block representing the page. Implements the Drawable interface.
func (*Polygon) SetBorderColor ¶
SetBorderColor sets the border color.
func (*Polygon) SetBorderOpacity ¶
SetBorderOpacity sets the border opacity.
func (*Polygon) SetBorderWidth ¶
SetBorderWidth sets the border width.
func (*Polygon) SetFillColor ¶
SetFillColor sets the fill color.
func (*Polygon) SetFillOpacity ¶
SetFillOpacity sets the fill opacity.
type Polyline ¶
type Polyline struct {
// contains filtered or unexported fields
}
Polyline represents a slice of points that are connected as straight lines. Implements the Drawable interface and can be rendered using the Creator.
func (*Polyline) GeneratePageBlocks ¶
func (_edfb *Polyline) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the polyline on a new block representing the page. Implements the Drawable interface.
func (*Polyline) SetLineColor ¶
SetLineColor sets the line color.
func (*Polyline) SetLineOpacity ¶
SetLineOpacity sets the line opacity.
func (*Polyline) SetLineWidth ¶
SetLineWidth sets the line width.
type Positioning ¶
type Positioning int
Positioning represents the positioning type for drawing creator components (relative/absolute).
const ( PositionRelative Positioning = iota PositionAbsolute )
func (Positioning) IsAbsolute ¶
func (_edef Positioning) IsAbsolute() bool
IsAbsolute checks if the positioning is absolute.
func (Positioning) IsRelative ¶
func (_aaf Positioning) IsRelative() bool
IsRelative checks if the positioning is relative.
type RadialShading ¶
type RadialShading struct {
// contains filtered or unexported fields
}
RadialShading holds information that will be used to render a radial shading.
func (*RadialShading) AddColorStop ¶
func (_dbfg *RadialShading) AddColorStop(color Color, point float64)
AddColorStop add color stop info for rendering gradient color.
func (*RadialShading) AddPatternResource ¶
func (_ddcgd *RadialShading) AddPatternResource(block *Block) (_gagb _dd.PdfObjectName, _aeeg error)
AddPatternResource adds pattern dictionary inside the resources dictionary.
func (*RadialShading) AddShadingResource ¶
func (_gfba *RadialShading) AddShadingResource(block *Block) (_aafdb _dd.PdfObjectName, _fabg error)
AddShadingResource adds shading dictionary inside the resources dictionary.
func (*RadialShading) SetAnchor ¶
func (_cadd *RadialShading) SetAnchor(anchor AnchorPoint)
SetAnchor set gradient position anchor. Default to center.
func (*RadialShading) SetAntiAlias ¶
func (_dbdd *RadialShading) SetAntiAlias(enable bool)
SetAntiAlias enables anti alias config.
Anti alias is disabled by default.
func (*RadialShading) SetBackgroundColor ¶
func (_bgaad *RadialShading) SetBackgroundColor(backgroundColor Color)
SetBackgroundColor set background color of the shading area.
By default the background color is set to white.
func (*RadialShading) SetBoundingBox ¶
func (_bada *RadialShading) SetBoundingBox(x, y, width, height float64)
SetBoundingBox set gradient color bounding box where the gradient would be rendered.
func (*RadialShading) SetExtends ¶
func (_becb *RadialShading) SetExtends(start bool, end bool)
SetExtends specifies whether ot extend the shading beyond the starting and ending points.
Text extends is set to `[]bool{false, false}` by default.
func (*RadialShading) ToPdfShadingPattern ¶
func (_gada *RadialShading) ToPdfShadingPattern() *_fee.PdfShadingPatternType3
ToPdfShadingPattern generates a new model.PdfShadingPatternType3 object.
type Rectangle ¶
type Rectangle struct {
// contains filtered or unexported fields
}
Rectangle defines a rectangle with upper left corner at (x,y) and a specified width and height. The rectangle can have a colored fill and/or border with a specified width. Implements the Drawable interface and can be drawn on PDF using the Creator.
func (*Rectangle) BorderColor ¶
BorderColor returns the border color of the rectangle.
func (*Rectangle) BorderOpacity ¶
BorderOpacity returns the border opacity of the rectangle (0-1).
func (*Rectangle) BorderWidth ¶
BorderWidth returns the border width of the rectangle.
func (*Rectangle) FillOpacity ¶
FillOpacity returns the fill opacity of the rectangle (0-1).
func (*Rectangle) GeneratePageBlocks ¶
func (_aebf *Rectangle) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks draws the rectangle on a new block representing the page. Implements the Drawable interface.
func (*Rectangle) GetCoords ¶
GetCoords returns the upper left corner coordinates of the rectangle (`x`, `y`).
func (*Rectangle) GetMargins ¶
GetMargins returns the margins of the rectangle: left, right, top, bottom.
func (*Rectangle) Height ¶
Height returns the height of the rectangle. NOTE: the returned value does not include the border width of the rectangle.
func (*Rectangle) Positioning ¶
func (_dcbf *Rectangle) Positioning() Positioning
Positioning returns the type of positioning the rectangle is set to use.
func (*Rectangle) ScaleToHeight ¶
ScaleToHeight scales the rectangle to the specified height. The width of the rectangle is scaled so that the aspect ratio is maintained.
func (*Rectangle) ScaleToWidth ¶
ScaleToWidth scales the rectangle to the specified width. The height of the rectangle is scaled so that the aspect ratio is maintained.
func (*Rectangle) SetBorderColor ¶
SetBorderColor sets border color of the rectangle.
func (*Rectangle) SetBorderOpacity ¶
SetBorderOpacity sets the border opacity of the rectangle.
func (*Rectangle) SetBorderRadius ¶
SetBorderRadius sets the radius of the rectangle corners.
func (*Rectangle) SetBorderWidth ¶
SetBorderWidth sets the border width of the rectangle.
func (*Rectangle) SetFillColor ¶
SetFillColor sets the fill color of the rectangle.
func (*Rectangle) SetFillOpacity ¶
SetFillOpacity sets the fill opacity of the rectangle.
func (*Rectangle) SetFitMode ¶
SetFitMode sets the fit mode of the rectangle. NOTE: The fit mode is only applied if relative positioning is used.
func (*Rectangle) SetMargins ¶
SetMargins sets the margins of the rectangle. NOTE: rectangle margins are only applied if relative positioning is used.
func (*Rectangle) SetPositioning ¶
func (_egee *Rectangle) SetPositioning(position Positioning)
SetPositioning sets the positioning of the rectangle (absolute or relative).
type StyledParagraph ¶
type StyledParagraph struct {
// contains filtered or unexported fields
}
StyledParagraph represents text drawn with a specified font and can wrap across lines and pages. By default occupies the available width in the drawing context.
func (*StyledParagraph) AddExternalLink ¶
func (_cfbad *StyledParagraph) AddExternalLink(text, url string) *TextChunk
AddExternalLink adds a new external link to the paragraph. The text parameter represents the text that is displayed and the url parameter sets the destionation of the link.
func (*StyledParagraph) AddInternalLink ¶
func (_eccd *StyledParagraph) AddInternalLink(text string, page int64, x, y, zoom float64) *TextChunk
AddInternalLink adds a new internal link to the paragraph. The text parameter represents the text that is displayed. The user is taken to the specified page, at the specified x and y coordinates. Position 0, 0 is at the top left of the page. The zoom of the destination page is controlled with the zoom parameter. Pass in 0 to keep the current zoom value.
func (*StyledParagraph) Append ¶
func (_gbgdf *StyledParagraph) Append(text string) *TextChunk
Append adds a new text chunk to the paragraph.
func (*StyledParagraph) EnableWordWrap ¶
func (_bfdda *StyledParagraph) EnableWordWrap(val bool)
EnableWordWrap sets the paragraph word wrap flag.
func (*StyledParagraph) GeneratePageBlocks ¶
func (_bcgde *StyledParagraph) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generates the page blocks. Multiple blocks are generated if the contents wrap over multiple pages. Implements the Drawable interface.
func (*StyledParagraph) GetMargins ¶
func (_fbbe *StyledParagraph) GetMargins() (float64, float64, float64, float64)
GetMargins returns the Paragraph's margins: left, right, top, bottom.
func (*StyledParagraph) Height ¶
func (_fdcd *StyledParagraph) Height() float64
Height returns the height of the Paragraph. The height is calculated based on the input text and how it is wrapped within the container. Does not include Margins.
func (*StyledParagraph) Insert ¶
func (_ffbf *StyledParagraph) Insert(index uint, text string) *TextChunk
Insert adds a new text chunk at the specified position in the paragraph.
func (*StyledParagraph) Reset ¶
func (_geegb *StyledParagraph) Reset()
Reset removes all the text chunks the paragraph contains.
func (*StyledParagraph) SetAngle ¶
func (_ceaa *StyledParagraph) SetAngle(angle float64)
SetAngle sets the rotation angle of the text.
func (*StyledParagraph) SetEnableWrap ¶
func (_eagc *StyledParagraph) SetEnableWrap(enableWrap bool)
SetEnableWrap sets the line wrapping enabled flag.
func (*StyledParagraph) SetLineHeight ¶
func (_deead *StyledParagraph) SetLineHeight(lineheight float64)
SetLineHeight sets the line height (1.0 default).
func (*StyledParagraph) SetMargins ¶
func (_acggb *StyledParagraph) SetMargins(left, right, top, bottom float64)
SetMargins sets the Paragraph's margins.
func (*StyledParagraph) SetPos ¶
func (_dcfeg *StyledParagraph) SetPos(x, y float64)
SetPos sets absolute positioning with specified coordinates.
func (*StyledParagraph) SetText ¶
func (_dacgf *StyledParagraph) SetText(text string) *TextChunk
SetText replaces all the text of the paragraph with the specified one.
func (*StyledParagraph) SetTextAlignment ¶
func (_afdab *StyledParagraph) SetTextAlignment(align TextAlignment)
SetTextAlignment sets the horizontal alignment of the text within the space provided.
func (*StyledParagraph) SetTextOverflow ¶
func (_gacaf *StyledParagraph) SetTextOverflow(textOverflow TextOverflow)
SetTextOverflow controls the behavior of paragraph text which does not fit in the available space.
func (*StyledParagraph) SetTextVerticalAlignment ¶
func (_edag *StyledParagraph) SetTextVerticalAlignment(align TextVerticalAlignment)
SetTextVerticalAlignment sets the vertical alignment of the text within the bounds of the styled paragraph.
Note: Currently Styled Paragraph doesn't support TextVerticalAlignmentBottom as that option only used for aligning text chunks.
In order to change the vertical alignment of individual text chunks, use TextChunk.VerticalAlignment.
func (*StyledParagraph) SetWidth ¶
func (_dddfg *StyledParagraph) SetWidth(width float64)
SetWidth sets the the Paragraph width. This is essentially the wrapping width, i.e. the width the text can extend to prior to wrapping over to next line.
func (*StyledParagraph) Width ¶
func (_agga *StyledParagraph) Width() float64
Width returns the width of the Paragraph.
type TOC ¶
type TOC struct {
// contains filtered or unexported fields
}
TOC represents a table of contents component. It consists of a paragraph heading and a collection of table of contents lines. The representation of a table of contents line is as follows:
[number] [title] [separator] [page]
e.g.: Chapter1 Introduction ........... 1
func (*TOC) GeneratePageBlocks ¶
func (_bccge *TOC) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generate the Page blocks. Multiple blocks are generated if the contents wrap over multiple pages.
func (*TOC) Heading ¶
func (_eggfd *TOC) Heading() *StyledParagraph
Heading returns the heading component of the table of contents.
func (*TOC) SetHeading ¶
SetHeading sets the text and the style of the heading of the TOC component.
func (*TOC) SetLineLevelOffset ¶
SetLineLevelOffset sets the amount of space an indentation level occupies for all new lines of the table of contents.
func (*TOC) SetLineMargins ¶
SetLineMargins sets the margins for all new lines of the table of contents.
func (*TOC) SetLineNumberStyle ¶
SetLineNumberStyle sets the style for the numbers part of all new lines of the table of contents.
func (*TOC) SetLinePageStyle ¶
SetLinePageStyle sets the style for the page part of all new lines of the table of contents.
func (*TOC) SetLineSeparator ¶
SetLineSeparator sets the separator for all new lines of the table of contents.
func (*TOC) SetLineSeparatorStyle ¶
SetLineSeparatorStyle sets the style for the separator part of all new lines of the table of contents.
func (*TOC) SetLineStyle ¶
SetLineStyle sets the style for all the line components: number, title, separator, page. The style is applied only for new lines added to the TOC component.
func (*TOC) SetLineTitleStyle ¶
SetLineTitleStyle sets the style for the title part of all new lines of the table of contents.
func (*TOC) SetShowLinks ¶
SetShowLinks sets visibility of links for the TOC lines.
type TOCLine ¶
type TOCLine struct { // Holds the text and style of the number part of the TOC line. Number TextChunk // Holds the text and style of the title part of the TOC line. Title TextChunk // Holds the text and style of the separator part of the TOC line. Separator TextChunk // Holds the text and style of the page part of the TOC line. Page TextChunk // contains filtered or unexported fields }
TOCLine represents a line in a table of contents. The component can be used both in the context of a table of contents component and as a standalone component. The representation of a table of contents line is as follows:
[number] [title] [separator] [page] e.g.: Chapter1 Introduction ........... 1
func (*TOCLine) GeneratePageBlocks ¶
func (_bfgbaa *TOCLine) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generate the Page blocks. Multiple blocks are generated if the contents wrap over multiple pages.
func (*TOCLine) GetMargins ¶
GetMargins returns the margins of the TOC line: left, right, top, bottom.
func (*TOCLine) LevelOffset ¶
LevelOffset returns the amount of space an indentation level occupies.
func (*TOCLine) SetLevelOffset ¶
SetLevelOffset sets the amount of space an indentation level occupies.
func (*TOCLine) SetLink ¶
SetLink makes the line an internal link. The text parameter represents the text that is displayed. The user is taken to the specified page, at the specified x and y coordinates. Position 0, 0 is at the top left of the page.
func (*TOCLine) SetMargins ¶
SetMargins sets the margins TOC line.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table allows organizing content in an rows X columns matrix, which can spawn across multiple pages.
func (*Table) AddSubtable ¶
AddSubtable copies the cells of the subtable in the table, starting with the specified position. The table row and column indices are 1-based, which makes the position of the first cell of the first row of the table 1,1. The table is automatically extended if the subtable exceeds its columns. This can happen when the subtable has more columns than the table or when one or more columns of the subtable starting from the specified position exceed the last column of the table.
func (*Table) EnablePageWrap ¶
EnablePageWrap controls whether the table is wrapped across pages. If disabled, the table is moved in its entirety on a new page, if it does not fit in the available height. By default, page wrapping is enabled. If the height of the table is larger than an entire page, wrapping is enabled automatically in order to avoid unwanted behavior.
func (*Table) EnableRowWrap ¶
EnableRowWrap controls whether rows are wrapped across pages. NOTE: Currently, row wrapping is supported for rows using StyledParagraphs.
func (*Table) GeneratePageBlocks ¶
func (_edge *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error)
GeneratePageBlocks generates the table page blocks. Multiple blocks are generated if the contents wrap over multiple pages. Implements the Drawable interface.
func (*Table) GetMargins ¶
GetMargins returns the left, right, top, bottom Margins.
func (*Table) GetRowHeight ¶
GetRowHeight returns the height of the specified row.
func (*Table) MultiCell ¶
MultiCell makes a new cell with the specified row span and col span and inserts it into the table at the current position.
func (*Table) MultiColCell ¶
MultiColCell makes a new cell with the specified column span and inserts it into the table at the current position.
func (*Table) MultiRowCell ¶
MultiRowCell makes a new cell with the specified row span and inserts it into the table at the current position.
func (*Table) NewCell ¶
NewCell makes a new cell and inserts it into the table at the current position.
func (*Table) SetColumnWidths ¶
SetColumnWidths sets the fractional column widths. Each width should be in the range 0-1 and is a fraction of the table width. The number of width inputs must match number of columns, otherwise an error is returned.
func (*Table) SetHeaderRows ¶
SetHeaderRows turns the selected table rows into headers that are repeated for every page the table spans. startRow and endRow are inclusive.
func (*Table) SetMargins ¶
SetMargins sets the Table's left, right, top, bottom margins.
func (*Table) SetPos ¶
SetPos sets the Table's positioning to absolute mode and specifies the upper-left corner coordinates as (x,y). Note that this is only sensible to use when the table does not wrap over multiple pages. TODO: Should be able to set width too (not just based on context/relative positioning mode).
func (*Table) SetRowHeight ¶
SetRowHeight sets the height for a specified row.
type TableCell ¶
type TableCell struct {
// contains filtered or unexported fields
}
TableCell defines a table cell which can contain a Drawable as content.
func (*TableCell) SetBackgroundColor ¶
SetBackgroundColor sets the cell's background color.
func (*TableCell) SetBorder ¶
func (_gabgc *TableCell) SetBorder(side CellBorderSide, style CellBorderStyle, width float64)
SetBorder sets the cell's border style.
func (*TableCell) SetBorderColor ¶
SetBorderColor sets the cell's border color.
func (*TableCell) SetBorderLineStyle ¶
SetBorderLineStyle sets border style (currently dashed or plain).
func (*TableCell) SetContent ¶
func (_dgfb *TableCell) SetContent(vd VectorDrawable) error
SetContent sets the cell's content. The content is a VectorDrawable, i.e. a Drawable with a known height and width. Currently supported VectorDrawables: - *Paragraph - *StyledParagraph - *Image - *Chart - *Table - *Division - *List - *Rectangle - *Ellipse - *Line
func (*TableCell) SetHorizontalAlignment ¶
func (_cbgdf *TableCell) SetHorizontalAlignment(halign CellHorizontalAlignment)
SetHorizontalAlignment sets the cell's horizontal alignment of content. Can be one of: - CellHorizontalAlignmentLeft - CellHorizontalAlignmentCenter - CellHorizontalAlignmentRight
func (*TableCell) SetSideBorderColor ¶
func (_cfgdc *TableCell) SetSideBorderColor(side CellBorderSide, col Color)
SetSideBorderColor sets the cell's side border color.
func (*TableCell) SetSideBorderStyle ¶
func (_eccba *TableCell) SetSideBorderStyle(side CellBorderSide, style CellBorderStyle)
SetSideBorderStyle sets the cell's side border style.
func (*TableCell) SetSideBorderWidth ¶
func (_dfbdf *TableCell) SetSideBorderWidth(side CellBorderSide, width float64)
SetSideBorderWidth sets the cell's side border width.
func (*TableCell) SetVerticalAlignment ¶
func (_aegfd *TableCell) SetVerticalAlignment(valign CellVerticalAlignment)
SetVerticalAlignment set the cell's vertical alignment of content. Can be one of: - CellHorizontalAlignmentTop - CellHorizontalAlignmentMiddle - CellHorizontalAlignmentBottom
func (*TableCell) Width ¶
func (_fdbdc *TableCell) Width(ctx DrawContext) float64
Width returns the cell's width based on the input draw context.
type TemplateOptions ¶
type TemplateOptions struct { // HelperFuncMap is used to define functions which can be accessed // inside the rendered templates by their assigned names. HelperFuncMap _ff.FuncMap // SubtemplateMap contains templates which can be rendered alongside // the main template. They can be accessed using their assigned names // in the main template or in the other subtemplates. // Subtemplates defined inside the subtemplates specified in the map // can be accessed directly. // All resources available to the main template are also available // to the subtemplates. SubtemplateMap map[string]_fg.Reader // FontMap contains pre-loaded fonts which can be accessed // inside the rendered templates by their assigned names. FontMap map[string]*_fee.PdfFont // ImageMap contains pre-loaded images which can be accessed // inside the rendered templates by their assigned names. ImageMap map[string]*_fee.Image // ColorMap contains colors which can be accessed // inside the rendered templates by their assigned names. ColorMap map[string]Color // ChartMap contains charts which can be accessed // inside the rendered templates by their assigned names. ChartMap map[string]_ef.ChartRenderable }
TemplateOptions contains options and resources to use when rendering a template with a Creator instance. All the resources in the map fields can be referenced by their name/key in the template which is rendered using the options instance.
type TextAlignment ¶
type TextAlignment int
TextAlignment options for paragraph.
const ( TextAlignmentLeft TextAlignment = iota TextAlignmentRight TextAlignmentCenter TextAlignmentJustify )
type TextChunk ¶
type TextChunk struct { // The text that is being rendered in the PDF. Text string // The style of the text being rendered. Style TextStyle // The vertical alignment of the text chunk. VerticalAlignment TextVerticalAlignment // contains filtered or unexported fields }
TextChunk represents a chunk of text along with a particular style.
func NewTextChunk ¶
NewTextChunk returns a new text chunk instance.
func (*TextChunk) Fit ¶
Fit fits the chunk into the specified bounding box, cropping off the remainder in a new chunk, if it exceeds the specified dimensions. NOTE: The method assumes a line height of 1.0. In order to account for other line height values, the passed in height must be divided by the line height: height = height / lineHeight
func (*TextChunk) SetAnnotation ¶
func (_bacba *TextChunk) SetAnnotation(annotation *_fee.PdfAnnotation)
SetAnnotation sets a annotation on a TextChunk.
type TextDecorationLineStyle ¶
type TextDecorationLineStyle struct { // Color represents the color of the line (default: the color of the text). Color Color // Offset represents the vertical offset of the line (default: 1). Offset float64 // Thickness represents the thickness of the line (default: 1). Thickness float64 }
TextDecorationLineStyle represents the style of lines used to decorate a text chunk (e.g. underline).
type TextOverflow ¶
type TextOverflow int
TextOverflow determines the behavior of paragraph text which does not fit in the available space.
const ( TextOverflowVisible TextOverflow = iota TextOverflowHidden )
type TextRenderingMode ¶
type TextRenderingMode int
TextRenderingMode determines whether showing text shall cause glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three. See section 9.3 "Text State Parameters and Operators" and Table 106 (pp. 254-255 PDF32000_2008).
const ( TextRenderingModeFill TextRenderingMode = iota TextRenderingModeStroke TextRenderingModeFillStroke TextRenderingModeInvisible TextRenderingModeFillClip TextRenderingModeStrokeClip TextRenderingModeFillStrokeClip TextRenderingModeClip )
type TextStyle ¶
type TextStyle struct { // Color represents the color of the text. Color Color // OutlineColor represents the color of the text outline. OutlineColor Color // Font represents the font the text will use. Font *_fee.PdfFont // FontSize represents the size of the font. FontSize float64 // OutlineSize represents the thickness of the text outline. OutlineSize float64 // CharSpacing represents the character spacing. CharSpacing float64 // HorizontalScaling represents the percentage to horizontally scale // characters by (default: 100). Values less than 100 will result in // narrower text while values greater than 100 will result in wider text. HorizontalScaling float64 // RenderingMode represents the rendering mode. RenderingMode TextRenderingMode // Underline specifies if the text chunk is underlined. Underline bool // UnderlineStyle represents the style of the line used to underline text. UnderlineStyle TextDecorationLineStyle // TextRise specifies a vertical adjustment for text. It is useful for // drawing subscripts/superscripts. A positive text rise value will // produce superscript text, while a negative one will result in // subscript text. TextRise float64 }
TextStyle is a collection of properties that can be assigned to a text chunk.
type TextVerticalAlignment ¶
type TextVerticalAlignment int
TextVerticalAlignment controls the vertical position of the text in a styled paragraph.
const ( TextVerticalAlignmentBaseline TextVerticalAlignment = iota TextVerticalAlignmentCenter TextVerticalAlignmentBottom TextVerticalAlignmentTop )
type UnsupportedRuneError ¶
UnsupportedRuneError is an error that occurs when there is unsupported glyph being used.
func (UnsupportedRuneError) Error ¶
func (_fdba UnsupportedRuneError) Error() string
String implements error interface.
type VectorDrawable ¶
type VectorDrawable interface { Drawable // Width returns the width of the Drawable. Width() float64 // Height returns the height of the Drawable. Height() float64 }
VectorDrawable is a Drawable with a specified width and height.