-
-
Notifications
You must be signed in to change notification settings - Fork 172
/
fpdf.go
193 lines (189 loc) · 7.56 KB
/
fpdf.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
package gofpdfwrapper
import (
"io"
"time"
"github.com/jung-kurt/gofpdf"
)
// Fpdf defines the interface used for various methods. It is implemented by the
// main FPDF instance as well as templates.
type Fpdf interface {
AddFont(familyStr, styleStr, fileStr string)
AddFontFromBytes(familyStr, styleStr string, jsonFileBytes, zFileBytes []byte)
AddUTF8FontFromBytes(familyStr, styleStr string, bytes []byte)
AddFontFromReader(familyStr, styleStr string, r io.Reader)
AddLayer(name string, visible bool) (layerID int)
AddLink() int
AddPage()
AddPageFormat(orientationStr string, size gofpdf.SizeType)
AddSpotColor(nameStr string, c, m, y, k byte)
AliasNbPages(aliasStr string)
ArcTo(x, y, rx, ry, degRotate, degStart, degEnd float64)
Arc(x, y, rx, ry, degRotate, degStart, degEnd float64, styleStr string)
BeginLayer(id int)
Beziergon(points []gofpdf.PointType, styleStr string)
Bookmark(txtStr string, level int, y float64)
CellFormat(w, h float64, txtStr, borderStr string, ln int, alignStr string, fill bool, link int, linkStr string)
Cellf(w, h float64, fmtStr string, args ...interface{})
Cell(w, h float64, txtStr string)
Circle(x, y, r float64, styleStr string)
ClearError()
ClipCircle(x, y, r float64, outline bool)
ClipEllipse(x, y, rx, ry float64, outline bool)
ClipEnd()
ClipPolygon(points []gofpdf.PointType, outline bool)
ClipRect(x, y, w, h float64, outline bool)
ClipRoundedRect(x, y, w, h, r float64, outline bool)
ClipText(x, y float64, txtStr string, outline bool)
Close()
ClosePath()
CreateTemplateCustom(corner gofpdf.PointType, size gofpdf.SizeType, fn func(*gofpdf.Tpl)) gofpdf.Template
CreateTemplate(fn func(*gofpdf.Tpl)) gofpdf.Template
CurveBezierCubicTo(cx0, cy0, cx1, cy1, x, y float64)
CurveBezierCubic(x0, y0, cx0, cy0, cx1, cy1, x1, y1 float64, styleStr string)
CurveCubic(x0, y0, cx0, cy0, x1, y1, cx1, cy1 float64, styleStr string)
CurveTo(cx, cy, x, y float64)
Curve(x0, y0, cx, cy, x1, y1 float64, styleStr string)
DrawPath(styleStr string)
Ellipse(x, y, rx, ry, degRotate float64, styleStr string)
EndLayer()
Err() bool
Error() error
GetAlpha() (alpha float64, blendModeStr string)
GetAutoPageBreak() (auto bool, margin float64)
GetCellMargin() float64
GetConversionRatio() float64
GetDrawColor() (int, int, int)
GetDrawSpotColor() (name string, c, m, y, k byte)
GetFillColor() (int, int, int)
GetFillSpotColor() (name string, c, m, y, k byte)
GetFontDesc(familyStr, styleStr string) gofpdf.FontDescType
GetFontSize() (ptSize, unitSize float64)
GetImageInfo(imageStr string) (info *gofpdf.ImageInfoType)
GetLineWidth() float64
GetMargins() (left, top, right, bottom float64)
GetPageSizeStr(sizeStr string) (size gofpdf.SizeType)
GetPageSize() (width, height float64)
GetStringWidth(s string) float64
GetTextColor() (int, int, int)
GetTextSpotColor() (name string, c, m, y, k byte)
GetX() float64
GetXY() (float64, float64)
GetY() float64
HTMLBasicNew() (html gofpdf.HTMLBasicType)
Image(imageNameStr string, x, y, w, h float64, flow bool, tp string, link int, linkStr string)
ImageOptions(imageNameStr string, x, y, w, h float64, flow bool, options gofpdf.ImageOptions, link int, linkStr string)
ImageTypeFromMime(mimeStr string) (tp string)
LinearGradient(x, y, w, h float64, r1, g1, b1, r2, g2, b2 int, x1, y1, x2, y2 float64)
LineTo(x, y float64)
Line(x1, y1, x2, y2 float64)
LinkString(x, y, w, h float64, linkStr string)
Link(x, y, w, h float64, link int)
Ln(h float64)
MoveTo(x, y float64)
MultiCell(w, h float64, txtStr, borderStr, alignStr string, fill bool)
Ok() bool
OpenLayerPane()
OutputAndClose(w io.WriteCloser) error
OutputFileAndClose(fileStr string) error
Output(w io.Writer) error
PageCount() int
PageNo() int
PageSize(pageNum int) (wd, ht float64, unitStr string)
PointConvert(pt float64) (u float64)
PointToUnitConvert(pt float64) (u float64)
Polygon(points []gofpdf.PointType, styleStr string)
RadialGradient(x, y, w, h float64, r1, g1, b1, r2, g2, b2 int, x1, y1, x2, y2, r float64)
RawWriteBuf(r io.Reader)
RawWriteStr(str string)
Rect(x, y, w, h float64, styleStr string)
RegisterAlias(alias, replacement string)
RegisterImage(fileStr, tp string) (info *gofpdf.ImageInfoType)
RegisterImageOptions(fileStr string, options gofpdf.ImageOptions) (info *gofpdf.ImageInfoType)
RegisterImageOptionsReader(imgName string, options gofpdf.ImageOptions, r io.Reader) (info *gofpdf.ImageInfoType)
RegisterImageReader(imgName, tp string, r io.Reader) (info *gofpdf.ImageInfoType)
SetAcceptPageBreakFunc(fnc func() bool)
SetAlpha(alpha float64, blendModeStr string)
SetAuthor(authorStr string, isUTF8 bool)
SetAutoPageBreak(auto bool, margin float64)
SetCatalogSort(flag bool)
SetCellMargin(margin float64)
SetCompression(compress bool)
SetCreationDate(tm time.Time)
SetCreator(creatorStr string, isUTF8 bool)
SetDashPattern(dashArray []float64, dashPhase float64)
SetDisplayMode(zoomStr, layoutStr string)
SetDrawColor(r, g, b int)
SetDrawSpotColor(nameStr string, tint byte)
SetError(err error)
SetErrorf(fmtStr string, args ...interface{})
SetFillColor(r, g, b int)
SetFillSpotColor(nameStr string, tint byte)
SetFont(familyStr, styleStr string, size float64)
SetFontLoader(loader gofpdf.FontLoader)
SetFontLocation(fontDirStr string)
SetFontSize(size float64)
SetFontStyle(styleStr string)
SetFontUnitSize(size float64)
SetFooterFunc(fnc func())
SetFooterFuncLpi(fnc func(lastPage bool))
SetHeaderFunc(fnc func())
SetHeaderFuncMode(fnc func(), homeMode bool)
SetHomeXY()
SetJavascript(script string)
SetKeywords(keywordsStr string, isUTF8 bool)
SetLeftMargin(margin float64)
SetLineCapStyle(styleStr string)
SetLineJoinStyle(styleStr string)
SetLineWidth(width float64)
SetLink(link int, y float64, page int)
SetMargins(left, top, right float64)
SetPageBoxRec(t string, pb gofpdf.PageBox)
SetPageBox(t string, x, y, wd, ht float64)
SetPage(pageNum int)
SetProtection(actionFlag byte, userPassStr, ownerPassStr string)
SetRightMargin(margin float64)
SetSubject(subjectStr string, isUTF8 bool)
SetTextColor(r, g, b int)
SetTextSpotColor(nameStr string, tint byte)
SetTitle(titleStr string, isUTF8 bool)
SetTopMargin(margin float64)
SetUnderlineThickness(thickness float64)
SetXmpMetadata(xmpStream []byte)
SetX(x float64)
SetXY(x, y float64)
SetY(y float64)
SplitLines(txt []byte, w float64) [][]byte
String() string
SVGBasicWrite(sb *gofpdf.SVGBasicType, scale float64)
Text(x, y float64, txtStr string)
TransformBegin()
TransformEnd()
TransformMirrorHorizontal(x float64)
TransformMirrorLine(angle, x, y float64)
TransformMirrorPoint(x, y float64)
TransformMirrorVertical(y float64)
TransformRotate(angle, x, y float64)
TransformScale(scaleWd, scaleHt, x, y float64)
TransformScaleX(scaleWd, x, y float64)
TransformScaleXY(s, x, y float64)
TransformScaleY(scaleHt, x, y float64)
TransformSkew(angleX, angleY, x, y float64)
TransformSkewX(angleX, x, y float64)
TransformSkewY(angleY, x, y float64)
Transform(tm gofpdf.TransformMatrix)
TransformTranslate(tx, ty float64)
TransformTranslateX(tx float64)
TransformTranslateY(ty float64)
UnicodeTranslatorFromDescriptor(cpStr string) (rep func(string) string)
UnitToPointConvert(u float64) (pt float64)
UseTemplateScaled(t gofpdf.Template, corner gofpdf.PointType, size gofpdf.SizeType)
UseTemplate(t gofpdf.Template)
WriteAligned(width, lineHeight float64, textStr, alignStr string)
Writef(h float64, fmtStr string, args ...interface{})
Write(h float64, txtStr string)
WriteLinkID(h float64, displayStr string, linkID int)
WriteLinkString(h float64, displayStr, targetStr string)
}
func NewCustom(init *gofpdf.InitType) Fpdf {
return gofpdf.NewCustom(init)
}