forked from itlabers/ofd-go
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pages_test.go
59 lines (53 loc) · 1.11 KB
/
pages_test.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
package ofd
import (
"os"
"path/filepath"
"testing"
)
func TestPages(t *testing.T) {
pwd, _ := os.Getwd()
file := filepath.Join(pwd, "samples", "DZHD_1605281110201000001_202205250016050102202100000069141950_20220525_000413.ofd")
ofdReader, err := NewOFDReader(file)
if err != nil {
t.Logf("%s", err)
}
defer ofdReader.Close()
ofd, err := ofdReader.OFD()
if err != nil {
t.Logf("%v", err)
} else {
t.Logf("%v", ofd)
}
index_0 := ofd.DocBody[0].DocInfo.DocID.Text
doc, err := ofdReader.GetDocumentById(index_0)
if err != nil {
t.Logf("%v", err)
} else {
t.Logf("%v", doc)
}
commonData, err := doc.GetCommonData()
if err != nil {
t.Logf("%v", err)
} else {
t.Logf("%v", commonData)
}
pages, err := doc.GetPages()
if err != nil {
t.Logf("%v", err)
} else {
t.Logf("%v", pages)
}
allPages, err := pages.GetPages()
if err != nil {
t.Logf("%v", err)
} else {
t.Logf("%v", allPages)
}
page_0 := pages.Page[0].ID
page, err := pages.GetPageById(page_0)
if err != nil {
t.Logf("%v", err)
} else {
t.Logf("%v", page)
}
}