Documentation ¶
Index ¶
- Variables
- type BarcodeElement
- type Builder
- func (q *Builder) Build() ([]byte, error)
- func (q *Builder) NewCapturedPage(sourcePage types.Page, sourceFile *pdffile.File) (*CapturedPage, error)
- func (q *Builder) NewCompositeFont(ttf []byte) (*pdf.CompositeFont, 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 CapturedPage
- type CircleElement
- type Color
- type ColorCMYK
- type ColorGray
- type ColorRGB
- type DashPattern
- type Element
- type EllipseElement
- type ImageBoxElement
- type ImageElement
- type Length
- type LineElement
- type LinearMeasure
- type Page
- type PageSize
- type RectElement
- type StandardPageSize
- type TextAlign
- 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
}
BarcodeElement is used to add a barcode to a page
func (*BarcodeElement) Build ¶ added in v1.0.20
func (q *BarcodeElement) Build(page *pdf.Page)
Build adds the element to the content stream
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 ¶
func (q *Builder) NewCapturedPage(sourcePage types.Page, sourceFile *pdffile.File) (*CapturedPage, error)
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) 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 CapturedPage ¶
type CapturedPage struct { CapturedPage *pdf.CapturedPage Left Length Top Length Scale float64 }
CapturedPage is used to add a captured page from another document to a page
func (*CapturedPage) Build ¶
func (q *CapturedPage) Build(page *pdf.Page)
Build adds the element to the content stream
func (*CapturedPage) PageSize ¶ added in v1.0.16
func (q *CapturedPage) PageSize() PageSize
PageSize returns the page size of the captured page
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
func (*CircleElement) Build ¶ added in v1.0.20
func (q *CircleElement) Build(page *pdf.Page)
Build adds the element to the content stream
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
func (DashPattern) Build ¶ added in v1.0.22
func (q DashPattern) Build(page *pdf.Page)
Build sets the dash pattern in the graphics state of the given page
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 {
X, Y, Width, Height Length
LineWidth Length
LineColor Color
FillColor Color
DashPattern DashPattern
}
EllipseElement is used to add an ellipse to a page
func (*EllipseElement) Build ¶ added in v1.0.22
func (q *EllipseElement) Build(page *pdf.Page)
Build adds the element to the content stream
type ImageBoxElement ¶
type ImageBoxElement struct { Img *pdf.Image Width Length Height Length Left Length Top Length VerticalAlign VerticalAlign HorizontalAlign TextAlign }
ImageBoxElement is used to add an image box to a page
func (*ImageBoxElement) Build ¶
func (q *ImageBoxElement) Build(page *pdf.Page)
Build adds the element to the content stream
type ImageElement ¶
ImageElement is used to add an image to a page
func (*ImageElement) Build ¶
func (q *ImageElement) Build(page *pdf.Page)
Build adds the element to the content stream
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
func (*LineElement) Build ¶
func (q *LineElement) Build(page *pdf.Page)
Build adds the element to the content stream
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 RectElement ¶
type RectElement struct {
X1, Y1, Width, Height Length
LineWidth Length
LineColor Color
FillColor Color
DashPattern DashPattern
}
RectElement is used to add a rectangle to a page
func (*RectElement) Build ¶
func (q *RectElement) Build(page *pdf.Page)
Build adds the element to the content stream
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 }
func (*TextBoxElement) Build ¶
func (q *TextBoxElement) Build(page *pdf.Page)
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 X, Y Length Font pdf.FontHandler FontSize float64 Color Color RenderMode types.RenderingMode OutlineColor Color OutlineWidth Length TextAlign TextAlign LineHeight float64 Italic bool Bold bool Underline bool Rotate float64 }
TextElement draws a text, may have line breaks
func (*TextElement) Build ¶
func (q *TextElement) Build(page *pdf.Page)
Build adds the element to the content stream
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. |