Documentation ¶
Index ¶
- Variables
- type BarcodeElement
- type BarcodeType
- type Builder
- func (q *Builder) Build() ([]byte, error)
- func (q *Builder) NewCapturedPage(sourcePage types.Page, sourceFile *pdffile.File) (*Form, error)
- func (q *Builder) NewCompositeFont(ttf []byte) (*pdf.CompositeFont, error)
- func (q *Builder) NewCompositeFontFromOTF(otf []byte) (*pdf.CompositeFontOTF, error)
- func (q *Builder) NewFormFromPage(page *Page) (*Form, error)
- func (q *Builder) NewImage(bts []byte) (*pdf.Image, error)
- func (q *Builder) NewPage(size PageSize) *Page
- func (q *Builder) NewPageBefore(size PageSize, beforePageNo int) *Page
- func (q *Builder) NewStandardFont(name types.StandardFontName, encoding types.Encoding) (*pdf.StandardFont, error)
- func (q *Builder) NewTrueTypeFont(ttf []byte, encoding types.Encoding, embed bool) (*pdf.TrueTypeFont, error)
- func (q *Builder) PageCount() int
- type CircleElement
- type Color
- type ColorCMYK
- type ColorGray
- type ColorRGB
- type DashPattern
- type Element
- type EllipseElement
- type Form
- type HorizontalAlign
- type ImageBoxElement
- type ImageElement
- type Length
- type LineElement
- type LinearMeasure
- type Page
- type PageSize
- type QRCodeElement
- type RectElement
- type StandardPageSize
- type TextBoxElement
- type TextElement
- type VerticalAlign
Constants ¶
This section is empty.
Variables ¶
var ColorRGBBlack = ColorRGB{R: 0, G: 0, B: 0}
Functions ¶
This section is empty.
Types ¶
type BarcodeElement ¶ added in v1.0.20
type BarcodeElement struct {
Left, Top, Width, Height Length
Text string
Color Color
Rotate float64
Flipped bool
Type BarcodeType
}
BarcodeElement is used to add a barcode to a page
type BarcodeType ¶ added in v1.0.31
type BarcodeType int
const ( BarcodeType39 BarcodeType = 1 BarcodeType128 BarcodeType = 3 )
type Builder ¶
type Builder struct { Info types.InformationDictionary ID [2]string CompressStreams bool Version float64 // contains filtered or unexported fields }
Builder is the main object to build a PDF file
func (*Builder) NewCapturedPage ¶
NewCapturedPage adds a new captured page to the PDF file
func (*Builder) NewCompositeFont ¶
func (q *Builder) NewCompositeFont(ttf []byte) (*pdf.CompositeFont, error)
NewCompositeFont adds a font as composite font to the pdf, i.e. with Unicode support
func (*Builder) NewCompositeFontFromOTF ¶ added in v1.0.31
func (q *Builder) NewCompositeFontFromOTF(otf []byte) (*pdf.CompositeFontOTF, error)
NewCompositeFontFromOTF adds a otf font as composite font to the pdf, i.e. with Unicode support
func (*Builder) NewFormFromPage ¶ added in v1.0.26
NewFormFromPage creates a new form object from the give page
func (*Builder) NewPageBefore ¶ added in v1.0.20
NewPageBefore inserts a new page before the given pageNo to the pdf
func (*Builder) NewStandardFont ¶
func (q *Builder) NewStandardFont(name types.StandardFontName, encoding types.Encoding) (*pdf.StandardFont, error)
NewStandardFont adds a new standard font (expected to be available in all PDF consuming systems) to the pdf
func (*Builder) NewTrueTypeFont ¶
func (q *Builder) NewTrueTypeFont(ttf []byte, encoding types.Encoding, embed bool) (*pdf.TrueTypeFont, error)
NewTrueTypeFont adds a new TrueType font to the pdf
type CircleElement ¶ added in v1.0.20
type CircleElement struct {
X, Y, Radius Length
LineWidth Length
LineColor Color
FillColor Color
DashPattern DashPattern
}
CircleElement is used to add a circle to a page
type Color ¶
Color is the interface any type of color needs to fulfill
func ParseColor ¶ added in v1.0.31
ParseColor parses a string to a color. Can be r,g,b or c,m,y,k or #RRGGBB
type ColorCMYK ¶
ColorCMYK represents a CMYK color value
func NewColorCMYK ¶
NewColorCMYK creates a new ColorCMYK object
type ColorGray ¶
type ColorGray struct {
Gray int
}
ColorGray represents a gray color value
func NewColorGray ¶
NewColorGray creates a new ColorGray object
type DashPattern ¶ added in v1.0.22
DashPattern represents a dash pattern
func NewDashPattern ¶ added in v1.0.22
func NewDashPattern(phase Length, array ...Length) DashPattern
NewDashPattern creates a new DashPattern object
type Element ¶
Element is the interface any object needs to fulfill to be added to the content stream of a page
type EllipseElement ¶ added in v1.0.22
type EllipseElement struct {
Left, Top, Width, Height Length
LineWidth Length
LineColor Color
FillColor Color
DashPattern DashPattern
}
EllipseElement is used to add an ellipse to a page
type Form ¶ added in v1.0.26
Form is used to add a captured page from another document to a page
type HorizontalAlign ¶ added in v1.0.35
type HorizontalAlign int
const ( HorizontalAlignLeft HorizontalAlign = 0 HorizontalAlignCenter HorizontalAlign = 1 HorizontalAlignRight HorizontalAlign = 2 )
type ImageBoxElement ¶
type ImageBoxElement struct {
Left, Top, Width, Height Length
Img *pdf.Image
VerticalAlign VerticalAlign
HorizontalAlign HorizontalAlign
}
ImageBoxElement is used to add an image box to a page
type ImageElement ¶
ImageElement is used to add an image to a page
type Length ¶
type Length struct { Value float64 Unit LinearMeasure }
Length represents a length using a certain measure
type LineElement ¶
type LineElement struct {
X1, Y1, X2, Y2 Length
LineWidth Length
Color Color
DashPattern DashPattern
}
LineElement is used to add a line to a page
type LinearMeasure ¶
type LinearMeasure int
LinearMeasure represents a linear measure like mm or inch.
const ( UnitPt LinearMeasure = iota UnitMM UnitInch )
type Page ¶
type Page struct { Width Length Height Length Rotate int // contains filtered or unexported fields }
Page represents on page in the PDF document to which elements can be added arbitrarily
func (*Page) AddElement ¶
AddElement adds one or more elements to the page
type PageSize ¶
type PageSize [2]Length
PageSize is width x height
func GetStandardPageSize ¶
func GetStandardPageSize(size StandardPageSize, landscape bool) PageSize
GetStandardPageSize returns a standard page size like DIN-A4 in either portrait or landscape
type QRCodeElement ¶ added in v1.0.23
type QRCodeElement struct {
Left, Top, Size Length
Text string
Color Color
RecoveryLevel qrcode.RecoveryLevel
}
QRCodeElement is used to add a QRCode to a page
type RectElement ¶
type RectElement struct {
Left, Top, Width, Height Length
LineWidth Length
LineColor Color
FillColor Color
DashPattern DashPattern
}
RectElement is used to add a rectangle to a page
type StandardPageSize ¶
type StandardPageSize int
StandardPageSize is used for GetStandardPageSize to get a standard page size like DIN-A4
const ( PageSizeA0 StandardPageSize = iota PageSizeA1 PageSizeA2 PageSizeA3 PageSizeA4 PageSizeA5 PageSizeA6 PageSizeA7 PageSizeLetter PageSizeLegal )
type TextBoxElement ¶
type TextBoxElement struct { TextElement Width, Height Length VerticalAlign VerticalAlign }
TextBoxElement is similar to TextElement, but can have a maximum width and height
func (*TextBoxElement) Build ¶
func (q *TextBoxElement) Build(page *pdf.Page) error
Build adds the element to the content stream
func (*TextBoxElement) TextHeight ¶
func (q *TextBoxElement) TextHeight() Length
TextHeight returns the height of the text, accounting for line breaks and max width
type TextElement ¶
type TextElement struct { Text string Left, Top Length Font pdf.FontHandler FontSize float64 Color Color RenderMode types.RenderingMode OutlineColor Color OutlineWidth Length TextAlign HorizontalAlign LineHeight float64 Bold bool Italic bool Underline bool StrikeThrough bool CharSpacing Length TextScaling float64 Rotate float64 }
TextElement draws a text, may have line breaks
func (*TextElement) Build ¶
func (q *TextElement) Build(page *pdf.Page) error
Build adds the element to the content stream
func (*TextElement) FontHeight ¶ added in v1.0.31
func (q *TextElement) FontHeight() Length
FontHeight returns the height of the font (bounding box y min to max)
func (*TextElement) TextHeight ¶
func (q *TextElement) TextHeight() Length
TextHeight returns the height of the text, accounting for line breaks
type VerticalAlign ¶
type VerticalAlign int
const ( VerticalAlignTop VerticalAlign = 0 VerticalAlignMiddle VerticalAlign = 1 VerticalAlignBottom VerticalAlign = 2 )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
standardfont/afm
Package afm implements a decoder for AFM (Adobe Font Metrics) files.
|
Package afm implements a decoder for AFM (Adobe Font Metrics) files. |
standardfont/fixed
Package fixed provides types to work with fixed-point numbers.
|
Package fixed provides types to work with fixed-point numbers. |