unidoc / unipdf

Golang PDF library for creating and processing PDF files (pure go)
https://unidoc.io
Other
2.5k stars 249 forks source link

[FEATURE] Creator: Set chapter title into header #384

Open gunnsth opened 4 years ago

gunnsth commented 4 years ago

Is your feature request related to a problem? Please describe. I would like to put information about the current chapter such as chapter number and chapter title into the page header, for example "1. Intro..." or something like that.

Currently when using

// Draw a header on each page.
c.DrawHeader(func(block *creator.Block, args creator.HeaderFunctionArgs) {
    // Draw the header on a block. The block size is the size of the page's top margins.
    block.Draw(this.logoImg)
})

there is no way to access the current chapter.

Describe the solution you'd like An easy way to access the current chapter which occurs on the page so one can get the chapter number and title.

Describe alternatives you've considered I tried accessing parameters in args and on the c creator instance, but did not find any parameters that could give the current context with the "current" chapter or "primary" chapter that applies to that page.

Should be consistent with outlines etc.

Additional context This is commonly done in reports to give more context in multi page documents where user might have forgotten what section they are reading.