unidoc / unipdf

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

[FEATURE] Drawing TOC in a specific page/area #529

Open ricardogama opened 9 months ago

ricardogama commented 9 months ago

Is your feature request related to a problem? Please describe.

We're trying to generate a document where the first page includes some content, let's say a title, an image, and a small table, and also the Table of Contents (TOC).

Currently the TOC functionality always renders a dedicated page as first page of the document (or second if DrawFirstPage is not set).

Since in our example the TOC is fairly small (just a couple of lines), it makes a huge waste os space and overall harder to navigate the document by having it as a separate page, while it makes more sense to include it in the first page with the other elements.

Describe the solution you'd like

Either:

Context

The idea is to achieve something like this (poor image editing skills):

Screenshot 2023-09-28 at 4 14 49 PM