forked from thecodingmachine/gotenberg-go-client
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsplit_intervals.go
47 lines (35 loc) · 1.02 KB
/
split_intervals.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
package gotenberg
import (
"strconv"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)
type SplitIntervalsRequest struct {
pdfs []document.Document
*baseRequest
}
func NewSplitIntervalsRequest(pdfs ...document.Document) *SplitIntervalsRequest {
br := newBaseRequest()
br.fields[fieldSplitMode] = splitModeIntervals
return &SplitIntervalsRequest{
pdfs: pdfs,
baseRequest: br,
}
}
func (req *SplitIntervalsRequest) endpoint() string {
return "/forms/pdfengines/split"
}
func (req *SplitIntervalsRequest) formDocuments() map[string]document.Document {
files := make(map[string]document.Document)
for _, pdf := range req.pdfs {
files[pdf.Filename()] = pdf
}
return files
}
// SplitSpan sets the interval for split.
func (req *SplitIntervalsRequest) SplitSpan(span int) {
req.fields[fieldSplitSpan] = strconv.Itoa(span)
}
// Flatten defines whether the resulting PDF should be flattened.
func (req *SplitIntervalsRequest) Flatten(val bool) {
req.fields[fieldSplitFlatten] = strconv.FormatBool(val)
}