Removing unwanted sub-headings from PDF contents

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
simona
Propeller Head
Posts: 56
Joined: Wed Feb 27, 2013 3:16 am
Location: Bremen, Germany

Removing unwanted sub-headings from PDF contents

Post by simona »

Hi there!

I have been working with Flare for a while now and building our HTML5 (tri-pane) web target works like a charm. We have been kind of single-sourcing in that I also build a PDF target with every major release from the same project, using the same TOC. However, that PDF has been for internal eyeballs only. It never contained a contents page and I have never used a TOC proxy before.

Now we have a new big customer and suddenly I need to create a proper printable PDF that is good enough for external eyeballs. ASAP, of course.

So far, I have wrapped my head around a few basic facts:
  • TOC proxies do exist.
  • I _can_ use the same TOC for both targets but they will not automatically create the same structure in PDF and web.
  • Advanced target settings include the nice little option "Use TOC depth for heading levels". I am using that now because I do want my web build and my PDF build to have the exact same structure.
  • My PDF TOC will kindly include as many heading levels as I want, provided I edit the mc-heading-level for H1 through H6 print mediums accordingly in my css file.
I ran a few test builds and did manage to include the print contents topic in my PDF output. Alas, my web TOC is 4 levels deep, but not for every book. There are nodes that are only 3 levels deep and consequently the sub-headings from inside these topics now also show up in my PDF contents as mc-heading-level 4. We do not want that (these sub-headings are: Context / Preconditions / Procedure / Result. For every topic).

At this point I feel a little stuck. Is there some quick, easy and elegant way to solve this while still using the same TOC for both targets? I have looked around the forum and the MadCap help. I did find one thread that mentions my problem but ultimately discusses the reverse solution (viewtopic.php?f=75&t=19580&hilit=TOC+html5+pdf).

Any thoughts on how to best approach this problem? Thanks in advance!
Flare 2023 r3, Capture 7
TechWriter with 10+ years Flare experience (software)
99% remote
ChoccieMuffin
Senior Propellus Maximus
Posts: 2630
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Removing unwanted sub-headings from PDF contents

Post by ChoccieMuffin »

Assuming most of the headings that have the same heading level as Context / Preconditions / Procedure / Result DO need to be in the TOC, here's what I'd do. For this question I'm just assuming they're all h4.

Create a class of h4 called, say, h4.NotInTOC, and set mc-heading-level to 0 in the stylesheet and medium you use for PDF. Apply h4.NotInTOC to those headings. That should take care of it. Hope it works for you :)
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
simona
Propeller Head
Posts: 56
Joined: Wed Feb 27, 2013 3:16 am
Location: Bremen, Germany

Re: Removing unwanted sub-headings from PDF contents

Post by simona »

Hi ChoccieMuffin,

yes, that's what I ended up doing just now. The unwanted headings are mostly H2 or H3 and I created a style class .NoTocPrintClass and searched 'n replaced the heck out of my project. Seems to work now, am just clearing up a few cases where manual work is needed.

Thanks for the tip. It does seems to be the easiest way to go forward if I do not want to (or have the time to) rethink my entire TOC structure for the web target. :P
Flare 2023 r3, Capture 7
TechWriter with 10+ years Flare experience (software)
99% remote
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Removing unwanted sub-headings from PDF contents

Post by NorthEast »

I set my PDF TOCs to look exactly like the help TOC - i.e. my PDF contents only contain the topic h1 headings, and not any sub-headings in a topic.

To do this:
* My topics all start with a h1 heading.
* I use the target setting Use TOC depth for heading levels.
* My CSS looks like this.
- h2-h6 are set to heading-level 0, which means sub-headings in topics are not included in the TOC.
- The h1.TOC classes are applied automatically (in the output) by the Use TOC depth... setting; e.g. if a topic's in the 2nd-level of the TOC, it will modify the topic's h1 heading to h1.TOC2. It's important to note that you do not manually apply these classes!
- You can also add styling to the to h1.TOC classes if you want.

Code: Select all

h2, h3, h4, h5, h6
{
	mc-heading-level: 0;
}

h1
{
	mc-heading-level: 1;
}

h1.TOC2
{
	mc-heading-level: 2;
}

h1.TOC3
{
	mc-heading-level: 3;
}

h1.TOC4
{
	mc-heading-level: 4;
}
simona
Propeller Head
Posts: 56
Joined: Wed Feb 27, 2013 3:16 am
Location: Bremen, Germany

Re: Removing unwanted sub-headings from PDF contents

Post by simona »

Hi Dave Lee and thank you, that works well too and has the added benefit of not having to apply new styles to all H1 in the project.

However, we have some unlinked TOC books. Using your solution these books are now included in the output itself (as otherwise empty pages with just the book name on them). That isn't all that bad but unfortunately they do not appear in the PDF contents, which makes the Contents confusing because it is missing structurally relevant entries.

I am already using the function Inject headings for unlinked books in TOC in my print target. Is there anything else I need to do so that these books also appear in the PDF Contents?
Flare 2023 r3, Capture 7
TechWriter with 10+ years Flare experience (software)
99% remote
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Removing unwanted sub-headings from PDF contents

Post by NorthEast »

I've just tried this and it works fine for me - the unlinked book items in the TOC are displayed correctly in the PDF Bookmarks panel, and also in Flare's generated TOC.
simona wrote:Using your solution these books are now included in the output itself (as otherwise empty pages with just the book name on them)
My solution won't have changed anything about that - that only appears if you select Inject headings for unlinked books in TOC.
simona
Propeller Head
Posts: 56
Joined: Wed Feb 27, 2013 3:16 am
Location: Bremen, Germany

Re: Removing unwanted sub-headings from PDF contents

Post by simona »

Dave Lee wrote:I've just tried this and it works fine for me - the unlinked book items in the TOC are displayed correctly in the PDF Bookmarks panel, and also in Flare's generated TOC.
I'm happy it works for you. Now I just have to find out why the unlinked books do appear in my PDF main body but not in my PDF Contents or in my PDF Bookmarks Panel.

Solved one problem, found another.... here we go.
Flare 2023 r3, Capture 7
TechWriter with 10+ years Flare experience (software)
99% remote
simona
Propeller Head
Posts: 56
Joined: Wed Feb 27, 2013 3:16 am
Location: Bremen, Germany

Re: Removing unwanted sub-headings from PDF contents

Post by simona »

simona wrote:Now I just have to find out why the unlinked books do appear in my PDF main body but not in my PDF Contents or in my PDF Bookmarks Panel.
What I have already found out:
  1. The problem does not apply to all books. Unlinked books on TOC level 1 _do_ appear in the generated TOC. Only unlinked books on level 2 and 3 do not (they just appear in the main PDF body).
  2. As soon as I link any topic to the formerly unlinked books on level 2 or 3 and run a build they do appear in the generated TOC as well
Still trying to find out what the problem is on my end. Have already written a support request to MadCap.

Update: Seeing this is a new issue I have started a new topic: viewtopic.php?f=10&t=31060
Flare 2023 r3, Capture 7
TechWriter with 10+ years Flare experience (software)
99% remote
Post Reply