summaryrefslogtreecommitdiff
path: root/document/document.go
diff options
context:
space:
mode:
Diffstat (limited to 'document/document.go')
-rw-r--r--document/document.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/document/document.go b/document/document.go
index a036eee..cd84875 100644
--- a/document/document.go
+++ b/document/document.go
@@ -134,6 +134,24 @@ func integrityCheck(tizio *GhlighDoc, caio *GhlighDoc) {
}
+func (d *GhlighDoc) GetNPages() int {
+ return d.doc.GetNPages()
+}
+
+func (d *GhlighDoc) GetPageText(i int) (string, error) {
+ nPages := d.doc.GetNPages()
+
+ if i < 0 || i > nPages {
+ return "", fmt.Errorf("error page %d out of range %d", i, nPages)
+ }
+
+ p := d.doc.GetPage(i)
+ defer p.Close()
+
+ text := p.Text()
+ return text, nil
+}
+
func (d *GhlighDoc) Save() (bool, error) {
d.mu.Lock()
defer d.mu.Unlock()