Excluding the front matter pages from the printed TOC

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.

Excluding the front matter pages from the printed TOC

Postby Rona Kwestel on Mon Mar 19, 2018 12:45 pm

I just answered my own question through a bit of rubber duck debugging, but figured I'd post it here with the solution in case it's helpful to anyone else.

Question
I am generating a PDF target using the same TOC for both HTML5 and PDF output. The "front matter" pages are included in the TOC (conditioned for PDF output only) so that their content appears in my output, but I don't want them to show up in the printed TOC itself; nobody needs to know that the cover page is on page i, or what page the TOC, which they're presently viewing, starts on. My TOC page simply has a title and a toc proxy, and I can't find a way to tell the proxy to start with the first page of actual content. Is there an easy way to do this without creating a duplicate TOC for the proxy that doesn't include the front matter pages?

Solution
When I started to type this extra bit of information to help solve my problem, I figured out the solution myself: "Interestingly, the copyright page doesn't appear in the TOC, and I'm not sure why."

It turns out that the copyright page has no "title", while the cover and TOC pages are using h1 tags for their "titles". Since the TOC proxy generates the TOC based on heading levels (in my case, h1-h3 headings), the title and TOC pages are showing up there. The solution is to add a class to the h1 tags on those pages and then "style" that class so it doesn't get picked up by the proxy. Here's the code to do that:

HTML
Code: Select all
<h1 class="notoc">My PDF</h1> // on the Title page
<h1 class="notoc">Table of Contents</h1> // on the TOC page


CSS
Code: Select all
@media print
{
    /* Leave h1 headings on the title and TOC pages out of the printed TOC */
    h1.notoc
    {
         mc-heading-level: 0;
    }
}
Rona Kwestel
Sr. Propeller Head
 
Posts: 176
Joined: Wed Apr 04, 2007 11:50 am

Re: Excluding the front matter pages from the printed TOC

Postby AlexFox on Tue Mar 20, 2018 8:48 am

Nice work debugging, this is the exact fix you needed :)
AlexFox
Propeller Head
 
Posts: 78
Joined: Thu Oct 19, 2017 1:56 am

Re: Excluding the front matter pages from the printed TOC

Postby Rona Kwestel on Tue Mar 20, 2018 9:36 am

Thanks, Alex. Sometimes you just need to talk yourself through it.
Rona Kwestel
Sr. Propeller Head
 
Posts: 176
Joined: Wed Apr 04, 2007 11:50 am


Return to Printed Documentation Targets

Who is online

Users browsing this forum: No registered users and 3 guests