Documentation
¶
Overview ¶
Package gopdfwrapper is a simple wrapper around the gopdf(https://github.com/signintech/gopdf) library aiming to simplify recurring tasks of creating PDF's with gopdf.
Index ¶
- Constants
- type Doc
- func (d *Doc) AddFormattedMultilineText(x, y float64, content string, size int, style string)
- func (d *Doc) AddFormattedText(x, y float64, content string, size int, style string)
- func (d *Doc) AddFormattedWrapText(x1, y, x2 float64, content string, size int, style string)
- func (d *Doc) AddLine(x1, y1, x2, y2, width float64, lineStyle LineStyle)
- func (d *Doc) AddMultilineText(x, y float64, content string)
- func (d *Doc) AddSizedText(x, y float64, content string, size int)
- func (d *Doc) AddText(x, y float64, content string) error
- func (d *Doc) AddWrapText(x1, y, x2 float64, content string)
- func (d *Doc) DefaultFontSize()
- func (d *Doc) DefaultFontStyle()
- func (d Doc) DefaultLineHeight() float64
- func (d Doc) LineHeight(fontSize int) float64
- func (d *Doc) SetFontFamily(family fonts.FontFamily) error
- func (d *Doc) SetFontSize(size int) error
- func (d *Doc) SetFontStyle(style string) error
- func (d *Doc) SetPosition(x, y float64)
- type FontStyle
- type LineStyle
Constants ¶
const ( // NormalStyle is the normal font style aka. regular style. NormalStyle FontStyle = gopdf.Regular // ItalicStyle represents the italic font style. ItalicStyle = gopdf.Italic // BoldStyle represents the bold font style. BoldStyle = gopdf.Bold // UnderlineStyle represents the underline font style. UnderlineStyle = gopdf.Underline )
const ( // SolidLine is a solid line. SolidLine LineStyle = "" // DashedLine is a dashed line. DashedLine = "dashed" // DottedLine is a dotted line. DottedLine = "dotted" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Doc ¶
Doc is the basic structure for a PDF file.
func (*Doc) AddFormattedMultilineText ¶
AddFormattedMultilineText has the same functionality as AddMultilineText but with a individual font-size and style.
func (*Doc) AddFormattedText ¶
AddFormattedText adds a text field at the given position with individual size and style.
func (*Doc) AddFormattedWrapText ¶ added in v0.3.0
AddFormattedWrapText automatically wraps the formatted text when the line reaches x2.
func (*Doc) AddMultilineText ¶
AddMultilineText adds a text field with multiple lines of text. The lines are divided by the new-line character `\n`.
func (*Doc) AddSizedText ¶
AddSizedText adds a text field at the given position with the given size.
func (*Doc) AddWrapText ¶ added in v0.3.0
AddWrapText automatically wraps the text when the line reaches x2.
func (*Doc) DefaultFontSize ¶
func (d *Doc) DefaultFontSize()
DefaultFontSize resets the font size to the initial default.
func (*Doc) DefaultFontStyle ¶
func (d *Doc) DefaultFontStyle()
DefaultFontStyle resets the font style to normal style.
func (Doc) DefaultLineHeight ¶
DefaultLineHeight calculates and returns the line height.
func (Doc) LineHeight ¶
LineHeight returns the line height of a text line with a given height in mm.
func (*Doc) SetFontFamily ¶
func (d *Doc) SetFontFamily(family fonts.FontFamily) error
SetFontFamily sets the used font family.
func (*Doc) SetFontSize ¶
SetFontSize sets the font size for all elements added after.
func (*Doc) SetFontStyle ¶
SetFontStyle changes the font style (italic, bold...) for elements added afterwards.
func (*Doc) SetPosition ¶
SetPosition encapsulates the SetX and SetY methods of gopdf. New elements will be added at the currently set position.