forked from stephenafamo/goldmark-pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdf.go
55 lines (42 loc) · 1.15 KB
/
pdf.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
package pdf
import (
"io"
)
type PDF interface {
// Add a new page
AddPage()
// Position
GetX() float64
GetY() float64
SetX(x float64)
SetY(y float64)
// Page size
GetPageSize() (width, height float64)
SetMarginLeft(margin float64)
SetMarginRight(margin float64)
GetMargins() (left, top, right, bottom float64)
// Font
AddFont(family string, style string, data []byte) error
SetFont(family string, style string, size int) error
// Writing
WriteText(height float64, text string)
CellFormat(w, h float64, txtStr, borderStr string, ln int, alignStr string, fill bool, link int, linkStr string)
WriteExternalLink(lineHeight float64, text, destination string)
BR(h float64)
// Images
RegisterImage(id, format string, src io.Reader)
UseImage(id string, x, y, w, h float64)
// Measuring
MeasureTextWidth(text string) float64
SplitText(txt string, w float64) []string
// Colors
SetDrawColor(r uint8, g uint8, b uint8)
SetFillColor(r uint8, g uint8, b uint8)
SetTextColor(r uint8, g uint8, b uint8)
// Width
SetLineWidth(width float64)
Line(x1, x2, y1, y2 float64)
// Rect(x1, x2, y1, y2 float64)
// Rendering
Write(io.Writer) error
}