I am using a script from @Bernardo_V which works quite well.
see: Applescript to extract the PDF's TOC into a markdown file