forked from thecodingmachine/gotenberg-go-client
-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
141 lines (131 loc) · 2.22 KB
/
types.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
package gotenberg
type SizeUnit string
const (
PT SizeUnit = "pt" // Points.
PX SizeUnit = "px" // Pixels.
IN SizeUnit = "in" // Inches.
MM SizeUnit = "mm" // Millimeters.
CM SizeUnit = "cm" // Centimeters.
PC SizeUnit = "pc" // Picas.
)
type PaperDimensions struct {
Width float64
Height float64
Unit SizeUnit
}
// nolint: gochecknoglobals
var (
// A0 paper size.
A0 = PaperDimensions{
Height: 46.8,
Width: 33.1,
Unit: IN,
}
// A1 paper size.
A1 = PaperDimensions{
Height: 33.1,
Width: 23.4,
Unit: IN,
}
// A2 paper size.
A2 = PaperDimensions{
Height: 23.4,
Width: 16.5,
Unit: IN,
}
// A3 paper size.
A3 = PaperDimensions{
Height: 16.5,
Width: 11.7,
Unit: IN,
}
// A4 paper size.
A4 = PaperDimensions{
Height: 11.7,
Width: 8.27,
Unit: IN,
}
// A5 paper size.
A5 = PaperDimensions{
Height: 8.3,
Width: 5.8,
Unit: IN,
}
// A6 paper size.
A6 = PaperDimensions{
Height: 5.8,
Width: 4.1,
Unit: IN,
}
// Letter paper size.
Letter = PaperDimensions{
Height: 11,
Width: 8.5,
Unit: IN,
}
// Legal paper size.
Legal = PaperDimensions{
Height: 14,
Width: 8.5,
Unit: IN,
}
// Tabloid paper size.
Tabloid = PaperDimensions{
Height: 17,
Width: 11,
Unit: IN,
}
// Ledger paper size.
Ledger = PaperDimensions{
Height: 17,
Width: 11,
Unit: IN,
}
)
type PageMargins struct {
Top float64
Bottom float64
Left float64
Right float64
Unit SizeUnit
}
// nolint: gochecknoglobals
var (
// NoMargins removes margins.
NoMargins = PageMargins{
Top: 0,
Bottom: 0,
Left: 0,
Right: 0,
Unit: IN,
}
// NormalMargins uses 1-inch margins.
NormalMargins = PageMargins{
Top: 1,
Bottom: 1,
Left: 1,
Right: 1,
Unit: IN,
}
// LargeMargins uses 2 inch margins.
LargeMargins = PageMargins{
Top: 2,
Bottom: 2,
Left: 2,
Right: 2,
Unit: IN,
}
)
type ImageFormat string
const (
PNG ImageFormat = "png"
JPEG ImageFormat = "jpeg"
WebP ImageFormat = "webp"
)
type PdfAFormat string
const (
// Deprecated: Beginning with version 7.6, LibreOffice has discontinued support for PDF/A-1a.
PdfA1b PdfAFormat = "PDF/A-1b"
PdfA2b PdfAFormat = "PDF/A-2b"
PdfA3b PdfAFormat = "PDF/A-3b"
)