-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdf.go
70 lines (60 loc) · 1.87 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package input
import (
"encoding/json"
"github.com/dynamicpdf-api/go-client/v2/element"
"github.com/dynamicpdf-api/go-client/v2/resource"
"github.com/google/uuid"
)
// Represents a pdf input.
type Pdf struct {
Input
pdfresource []resource.PdfResource
Elements []element.ElementCollector `json:"elements"` /*TODO:Type*/
}
var _ InputCollector = (*Pdf)(nil)
var _ json.Marshaler = (*Pdf)(nil)
/*
Initializes a new instance of the `PdfInput` class.
- @param { string } The resource path in cloud resource manager.
- @param {MergeOptions} mergeOptions The merge options for the pdf.
*/
func NewPdfWithCloudPath(cloudResourcePath string, option MergeOptions) *Pdf {
var p Pdf
p.Elements = []element.ElementCollector{}
p = Pdf{Input: *newInput(cloudResourcePath)}
p.inputType = p.InputType()
p.MergeOption = option
return &p
}
/*
Initializes a new instance of the `PdfInput` class.
- @param { PdfResource} resource The resource of type `PdfResource`.
- @param {MergeOptions} mergeOptions The merge options for the pdf.
*/
func NewPdfWithResource(resource resource.PdfResource) *Pdf {
p := Pdf{Input: *newInputWithResource(resource.Resource)}
p.SetId(uuid.NewString())
p.Elements = []element.ElementCollector{}
p.inputType = p.InputType()
return &p
}
/*
Initializes a new instance of the `PdfInput` class.
- @param { PdfResource} resource The resource of type `PdfResource`.
- @param {MergeOptions} mergeOptions The merge options for the pdf.
*/
func NewPdfWithResourceWithMergerOption(resource resource.PdfResource, option MergeOptions) *Pdf {
var p Pdf
p.SetId(uuid.NewString())
p = Pdf{Input: *newInputWithResource(resource.Resource)}
p.Elements = []element.ElementCollector{}
p.inputType = p.InputType()
p.MergeOption = option
return &p
}
func (p *Pdf) InputType() InputType {
return PdfInput
}
func (p *Pdf) Resources() []resource.Resource {
return p.resources
}