Documentation ¶
Index ¶
- Variables
- 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) 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 Color
- type ColorCMYK
- type ColorGray
- type ColorRGB
- type Element
- 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 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) 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 }
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 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 Element ¶
Element is the interface any object needs to fulfill to be added to the content stream of a page
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 ¶
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
}
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 }
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. |