PDF Export - Limit Table of Contents

I created a new PDF template and added appropriate classes and objects for header footer and toc.
Everything worked for the header and footer.
At toc, my changes are only written over the table of contents and the table is printed as always.
However, I would like to change the directory so that it is limited to a depth of 2. Is that possible and if so how?