var ( DefaultFontSize = 12.0 // the height of font sized 12 points, possible default fonts for Word and Excel are 11 or 12 points. DefaultImageEncoder core.StreamEncoder )
var RtlFontFile *model.PdfFont
var StdFontsMap = map[string][]string{ "Helvetica": []string{ "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique", }, "Courier": []string{ "Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique", }, "Times New Roman": []string{ "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", }, "default": []string{ "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique", }, }
func AdjustColor(colorStr string, EG_ColorTransform []*dml.EG_ColorTransform) string
AdjustColor adjusts a color represented by a hexadecimal string with a given array of transform values.
func AdjustColorByLumMod(colorStr string, lum float64) string
AdjustColorByLumMod adjusts a color represented by a hexadecimal string with a given luminance modulation.
func AdjustColorByShade(colorStr string, shade float64) string
AdjustColorByShade adjusts a color represented by a hexadecimal string with a given shade.
func AdjustColorByTint(colorStr string, tint float64) string
AdjustColorByTint adjusts a color represented by a hexadecimal string with a given tint.
func AssignStdFontByName(style creator.TextStyle, fontName string) *model.PdfFont
func ClearRegisteredFonts()
func CropImageByRect(sourceImg image.Image, rect image.Rectangle) image.Image
func DrawLine(c *creator.Creator, x0, y0, x1, y1, width float64, color creator.Color)
DrawLine draws a line with given coordinates, width and color.
func DrawRectangle(c *creator.Creator, r *Rectangle, w float64, color creator.Color)
DrawRectangle draws a rectangle with given coordinates, width and color.
func FillRectangle(c *creator.Creator, x, y, width, height float64, color creator.Color)
FillRectangle fills a rectangle with given coordinates and color.
func FromSTCoordinate(st dml.ST_Coordinate) int64
FromSTCoordinate returns an int64 value from dml.ST_Coordinate or 0 in the case of nil.
func FromSTCoordinate32(st dml.ST_Coordinate32) int64
FromSTCoordinate32 returns an int64 value from dml.ST_Coordinate32 or 0 in the case of nil.
func FromSTPercentage(st *dml.ST_Percentage) float64
func GetColorStringFromDmlColor(dmlColor *dml.CT_Color) string
GetColorStringFromDmlColor returns a hexadecimal string representation of dml.CT_Color in the 'rgb' format.
func GetDataFromXfrm(xfrm *dml.CT_Transform2D) (float64, float64, float64, float64)
func GetGroupOffsetFromXfrm(xfrm *dml.CT_GroupTransform2D) (float64, float64)
func GetImage(c *creator.Creator, goImg image.Image, imgHeight, imgWidth, left, top, dividerX, dividerY float64, part ImgPart) (*creator.Image, error)
func GetOpacityFromColorTransform(trs []*dml.EG_ColorTransform) float64
func GetPageFromCreator(c *creator.Creator) (*model.PdfPage, error)
func GetRegisteredFont(name string, style FontStyle) *model.PdfFont
func IsNoSpaceLanguage(symbol string) bool
func Lighten(clr float64) float64
Lighten makes a r, g or b channel value lighter by 40% for getting colors of headers and footers.
func LoadFontFromFile(filename string) (*model.PdfFont, error)
LoadFontFromFile loads PDF font from ttf file and returns it
func MakeBlockFromChartSpace(cs *crt.ChartSpace, width, height float64, theme *dml.Theme) (*creator.Block, error)
MakeBlockFromChartSpace makes creator.Block from the chart space.
func MakeBlockFromCreator(c *creator.Creator) (*creator.Block, error)
MakeBlockFromCreator makes a creator.Block from the first page of a creator.
func MakeImageFromChartSpace(cs *crt.ChartSpace, width, height float64, theme *dml.Theme, workbook *spreadsheet.Workbook) (image.Image, error)
MakeBlockFromChartSpace renders a Go image from the chart space.
func MakeTempCreator(width, height float64) *creator.Creator
MakeTempCreator returns a creator.Creator with a given width and height in millimeters.
func MakeTempCreatorMaxHeight(width float64) *creator.Creator
MakeTempCreator returns a creator.Creator with a given width in millimeters and unlimited height.
func ParseExcelRange(s string) (string, reference.CellReference, reference.CellReference, error)
func PointsFromTwips(twips int64) float64
PointsFromTwips converts twips to points.
func RegisterEmbeddedFonts(d *document.Document) error
func RegisterFont(name string, style FontStyle, font *model.PdfFont)
RegisterFont makes a PdfFont accessible for using in converting to PDF.
func RegisterFontsFromDirectory(dirName string) error
RegisterFontsFromDirectory registers all fonts from the given directory.
func RegisterFontsFromFiles(files []string) error
RegisterFontsFromFiles registers all fonts from given slice of files.
func TwipsFromPoints(points float64) float64
TwipsFromPoints converts points to twips.
type BorderPosition byte
const ( BorderPositionTop BorderPosition = 0 BorderPositionLeft BorderPosition = 1 BorderPositionBottom BorderPosition = 2 BorderPositionRight BorderPosition = 3 )
FontStyle represents a kind of font styling. It can be FontStyle_Regular, FontStyle_Bold, FontStyle_Italic and FontStyle_BoldItalic.
type FontStyle byte
const ( FontStyle_Regular FontStyle = 0 FontStyle_Bold FontStyle = 1 FontStyle_Italic FontStyle = 2 FontStyle_BoldItalic FontStyle = 3 )
func (fs FontStyle) String() string
String returns a string representation of FontStyle for logging purposes.
type ImgPart byte
const ( ImgPart_whole ImgPart = 0 ImgPart_t ImgPart = 1 ImgPart_b ImgPart = 2 ImgPart_l ImgPart = 3 ImgPart_r ImgPart = 4 ImgPart_lt ImgPart = 5 ImgPart_rt ImgPart = 6 ImgPart_lb ImgPart = 7 ImgPart_rb ImgPart = 8 )
Rectangle represents a rectangle with top, bottom, left and right float64 coordinates.
type Rectangle struct { Top float64 Bottom float64 Left float64 Right float64 }
func (r *Rectangle) Translate(x, y float64)
Translate moves a rectangle by provided x and y, which can be positive or negative float64.