-
Notifications
You must be signed in to change notification settings - Fork 3
/
outline.go
37 lines (30 loc) · 932 Bytes
/
outline.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
package goharu
//#cgo CFLAGS: -I${SRCDIR}/libharu/include
//#include <hpdf.h>
import "C"
import "unsafe"
//Outline struct keeps outline
type Outline struct {
ptr C.HPDF_Outline
}
//CreateOutline creates a new outline object.
func (pdf *Doc) CreateOutline(parent Outline, title string, encoder Encoder) Outline {
_title := C.CString(title)
defer C.free(unsafe.Pointer(_title))
rc := C.HPDF_CreateOutline(pdf.ptr, parent.ptr, _title, encoder.ptr)
return Outline{ptr: rc}
}
//SetOpened sets flag indicating whether the outline is opened
func (outline *Outline) SetOpened(opened bool) {
var _opened C.int
if opened {
_opened = C.HPDF_TRUE
} else {
_opened = C.HPDF_FALSE
}
C.HPDF_Outline_SetOpened(outline.ptr, _opened)
}
//SetDestination sets outline destination
func (outline *Outline) SetDestination(dst Destination) {
C.HPDF_Outline_SetDestination(outline.ptr, dst.ptr)
}