Tables of content made by the contextual command are RTF files. There is a valuable script here
that formerly converted RTF to PDF. (Use the version from Patrick, at the bottom of the thread.) Unfortunately, since OS X 10.11 apparently broke the /usr/sbin/cupsfilter, the script throws an error and dies. The Apple forum link I gave you has a way to fix that problem. There are lots of scriptable alternates to making RTF into PDF, though. For examples, browse Macscripter – or just ask Google.
Apart from writing or modifying scripts, a way to hand hack this is to
(1) make your TOC file,
(2) use File > Print to print it as a PDF to DEVONthink,
(3) merge your PDFs
(4) drag the TOC you printed to PDF into the sidebar of the merged document as the first page
You can drag a PDF into the sidebar of another PDF. Or you could just merge the PDFs and the TOC PDF and rearrange pages in the sidebar.
HOWEVER … the links in that TOC open the un-merged documents, not pages in the merged documents. So, you’ll want to convert the RTF TOC to a plain text TOC before printing it.
BTW, you cannot add scripts to the contextual menu.
Thank for this korm. I wondered why some of my scripts using cupsfilter were no longer working. When cupsfilter stopped working I took a different approach and scripted textedit directly to produce the pdf.