You can add bookmarks to exported files using the Scroll Bookmark macro.
Bookmarks are added in the form of named destinations
The Scroll Bookmark macro does not insert bookmarks that can be accessed in the TOC to the exported PDF files – but rather creates 'named destinations' that can be used in links to the PDF file to directly jump to a certain position in the exported PDF.
To add a bookmark, simply insert the Scroll Bookmark macro on your Confluence page and enter a bookmark ID. This will be the title of the bookmark in your exported document.
Bookmark name must start with a letter
IDs must begin with a letter ([A-Za-z]) followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), and periods (".").
Now, bookmarks will be added to the exports in the locations where you added the macros.