forked from signintech/gopdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage_obj.go
46 lines (38 loc) · 1 KB
/
page_obj.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
package gopdf
import (
"bytes"
//"fmt"
)
//PageObj pdf page object
type PageObj struct { //impl IObj
buffer bytes.Buffer
Contents string
ResourcesRelate string
}
func (p *PageObj) init(funcGetRoot func() *GoPdf) {
}
func (p *PageObj) build() error {
p.buffer.WriteString("<<\n")
p.buffer.WriteString(" /Type /" + p.getType() + "\n")
p.buffer.WriteString(" /Parent 2 0 R\n")
p.buffer.WriteString(" /Resources " + p.ResourcesRelate + "\n")
/*me.buffer.WriteString(" /Font <<\n")
i := 0
max := len(me.Realtes)
for i < max {
realte := me.Realtes[i]
me.buffer.WriteString(fmt.Sprintf(" /F%d %d 0 R\n",realte.CountOfFont + 1, realte.IndexOfObj + 1))
i++
}
me.buffer.WriteString(" >>\n")*/
//me.buffer.WriteString(" >>\n")
p.buffer.WriteString(" /Contents " + p.Contents + "\n") //sample Contents 8 0 R
p.buffer.WriteString(">>\n")
return nil
}
func (p *PageObj) getType() string {
return "Page"
}
func (p *PageObj) getObjBuff() *bytes.Buffer {
return &(p.buffer)
}