mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-05 19:30:30 +08:00
Add SetTOC method to the creator
This commit is contained in:
parent
89965a3784
commit
287b6e29ca
@ -142,6 +142,16 @@ func (c *Creator) TOC() *TOC {
|
|||||||
return c.toc
|
return c.toc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetTOC sets the table of content component of the creator.
|
||||||
|
// This method should be used when building a custom table of contents.
|
||||||
|
func (c *Creator) SetTOC(toc *TOC) {
|
||||||
|
if toc == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.toc = toc
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Creator) setActivePage(p *model.PdfPage) {
|
func (c *Creator) setActivePage(p *model.PdfPage) {
|
||||||
c.activePage = p
|
c.activePage = p
|
||||||
}
|
}
|
||||||
@ -293,8 +303,8 @@ func (c *Creator) Context() DrawContext {
|
|||||||
return c.context
|
return c.context
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call before writing out. Takes care of adding headers and footers, as well as generating front
|
// Call before writing out. Takes care of adding headers and footers, as well
|
||||||
// Page and table of contents.
|
// as generating front Page and table of contents.
|
||||||
func (c *Creator) finalize() error {
|
func (c *Creator) finalize() error {
|
||||||
totPages := len(c.pages)
|
totPages := len(c.pages)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user