Hi, in your aftemplate document, you mentioned creating headers last if you want the PDF table of contents output to be correct.
I can shed some light on how to fix that in affinity for you.
If you click on the anchors tab, and then delete ALL of them. Then regenerate your table of contents. The PDF bookmarks will be magically fixed once more.