-
Notifications
You must be signed in to change notification settings - Fork 0
/
html.go
66 lines (57 loc) · 1.48 KB
/
html.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
package input
import (
"github.com/dynamicpdf-api/go-client/v2/resource"
"github.com/google/uuid"
)
// Represents a HTML input.
type Html struct {
Converter
}
var _ InputCollector = (*Html)(nil)
/*
Initializes a new instance of the `HTMLInput` class.
- @param { string} input The html embeded as a string.
*/
func NewHtmlInputWithString(inputString string) *Html {
var p Html
var ep resource.HtmlResource
var name = uuid.NewString()
resourceData := []byte(inputString)
ep = resource.HtmlResource{Resource: *resource.NewResourceWithByteValue(resourceData, name)}
p.resources = append(p.resources, ep.Resource)
p.inputType = p.InputType()
p.getPaperSize(Letter)
p.SetPageHeight(p.larger)
p.SetPageWidth(p.smaller)
p.ResourceName = ep.ResourceName
return &p
}
/*
Initializes a new instance of the `HTMLInput` class.
- @param { string} input The html embeded as a string.
*/
func NewHtmlInputWithResource(resource resource.HtmlResource) *Html {
var p Html
p.resources = append(p.resources, resource.Resource)
p.SetId(uuid.NewString())
p.inputType = p.InputType()
p.getPaperSize(Letter)
p.SetPageHeight(p.larger)
p.SetPageWidth(p.smaller)
p.ResourceName = resource.ResourceName
return &p
}
func (p *Html) Resources() []resource.Resource {
return p.resources
}
func (p *Html) InputType() InputType {
return HtmlInput
}
// Gets the BasePath.
func (p *Html) BasePath() string {
return p.basePath
}
// sets the BasePath.
func (p *Html) SetBasePath(value string) {
p.basePath = value
}