Merge PDF + TOC

A search showed a couple of results, most dating a couple of years back.
A recent Tuesday tip mentioned the TOC feature.

Tried this out but this does not yield the desired result.

This is what I want to achieve:

  • credit card statement tickler file
  • group per month
  • each month contains that month’s statement + available details, bills & related stuff in separate PDF

=> I’d like to create a script to be added to context menu command that will merge the selected PDF’s, creates a TOC as the 1st page and saves this as a single multipage PDF with the TOC as frontpage

Has this been done yet?
How to do it?

Any help / pointer much appreciated!

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.

Frederiko