PDF target printing half the TOC as single lines

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
Graham Campbell
Propeller Head
Posts: 54
Joined: Tue Oct 30, 2007 4:40 am
Location: Glasgow, Scotland, UK

PDF target printing half the TOC as single lines

Post by Graham Campbell »

My target is printing to a PDF, and my TOC file is using a TOC proxy.

The problem I'm seeing is the TOC is printing approximately half the TOC entries as single lines on new pages (around 20 of those) and then prints the other half as you would normally expected, all leveled and grouped together properly.

I can't explain this as they should all be using the same style as the TOC proxy, right?

I'm totally lost after spending nearly a full two days on this single issue.

Any help would be most appreciated.

Regards,
Graham
garyjgeoaccess
Sr. Propeller Head
Posts: 148
Joined: Mon Feb 16, 2009 3:23 pm

Re: PDF target printing half the TOC as single lines

Post by garyjgeoaccess »

It'd help if you posted screenshots of sample PDF pages from the TOC.

Otherwise, I'm not sure I'm envisioning the same thing that you're trying to explain.

Or maybe just extract the TOC pages from your PDF, zip 'em up, and attach it to this thread.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: PDF target printing half the TOC as single lines

Post by LTinker68 »

The TOC styles are pulled from p.TOC1, p.TOC2, etc. Check those styles in both the default and print mediums and see if you have any page-break-before or page-break-after attributes set. Those styles will inherit properties from the main <p> tag, so if you had set page-break settings on the <p> tag, then you need to override those settings in the TOC paragraph styles. Same with widow and orphan attributes, although I'm not convinced those attributes work.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Graham Campbell
Propeller Head
Posts: 54
Joined: Tue Oct 30, 2007 4:40 am
Location: Glasgow, Scotland, UK

Re: PDF target printing half the TOC as single lines

Post by Graham Campbell »

I have about 25 pages of this rubbish:
wrong.png
followed by a single page of this, which is what I want:
right.png

Some more info:

I'm using a TOC proxy, and my understanding is that the styles are picked up for the TOC overall from the TOC.proxy style.

None of my pTOC styles have page breaks set. In fact, the only difference in each of the headings is the indent from the left-hand margin.

The exact same TOC topic and stylesheets work perfectly in another project.

I don't set new chapter breaks in the TOC options for anything other than the very first page of content (to ensure it is separated from the TOC in the printed manual).
You do not have the required permissions to view the files attached to this post.
garyjgeoaccess
Sr. Propeller Head
Posts: 148
Joined: Mon Feb 16, 2009 3:23 pm

Re: PDF target printing half the TOC as single lines

Post by garyjgeoaccess »

This looks like a page layout problem.

The left (even) page of the layout being used for the TOC might be faulty. The right (odd) pages look fine, right?

Check the body frame in the left page layout. How large is the body frame? Is it possible it's just a horizontal slot, just big enough for one line?

This would sure result in the output that you're getting.

If the body frame is okay for the left pages ...
You might want to post some of the code from the page layout document being used by your TOC. I don't think this can be a stylesheet problem. It's almost certainly a page layout problem.
Graham Campbell
Propeller Head
Posts: 54
Joined: Tue Oct 30, 2007 4:40 am
Location: Glasgow, Scotland, UK

Re: PDF target printing half the TOC as single lines

Post by Graham Campbell »

garyjgeoaccess wrote:This looks like a page layout problem.

The left (even) page of the layout being used for the TOC might be faulty. The right (odd) pages look fine, right?
Afraid not, no. The page numbers on display in the attached images are just chance and not indicative of a difference in the page layouts - indeed, I only have one page in my page layout for the TOC which is used for both recto and verso pages. There are 25 pages of the single-line nonsense on both even and odd numbered pages.
garyjgeoaccess
Sr. Propeller Head
Posts: 148
Joined: Mon Feb 16, 2009 3:23 pm

Re: PDF target printing half the TOC as single lines

Post by garyjgeoaccess »

Post your page layout code. There might be something amiss in this file.

also it'd help if we could see the entire table of contents (warts and all). Zip it up and post it. The page breaks are happening because of something in the code somewhere. What is consistent about the headings when page breaks are triggered?

Lisa's suggestion is solid. Look at your TOC styles (TOC1, TOC2, TOC3, etc.). Is it possible one of these styles includes "page-break-after: always" or "page-break-before: always"?
Graham Campbell
Propeller Head
Posts: 54
Joined: Tue Oct 30, 2007 4:40 am
Location: Glasgow, Scotland, UK

Re: PDF target printing half the TOC as single lines

Post by Graham Campbell »

garyjgeoaccess wrote:Lisa's suggestion is solid. Look at your TOC styles (TOC1, TOC2, TOC3, etc.). Is it possible one of these styles includes "page-break-after: always" or "page-break-before: always"?
None of my p.TOC1 etc. styles have any of the page-break attributes (before, after or inside) set. Surely though, if they were set, this would affect all heading styles, and not just the first 20?

I don't see anything in my content that is consistent about where the page breaks are happening. The affected topics are running off the same style sheet and the same page layout as the unaffected topics.

My Page Layout code is as follows:

<?xml version="1.0" encoding="utf-8"?>
<PageStyles>
<Page Name="First" Width="800" Height="800" Padding="20px" PageSize="A4" PageType="first" PaddingLeft="3.5cm" PaddingRight="2.5cm" PaddingTop="2.5cm" PaddingBottom="2.5cm">
<Frame Flow="body" ColumnCount="1" Anchors="" PaddingLeft="0in" PaddingRight="0in" PaddingTop="0in" PaddingBottom="0in" X="-0.1041667in" Y="" Right="0in" Bottom="0in" Width="15.26646cm" Height="24.71208cm">
</Frame>
<Frame Flow="footer" Anchors="" Right="0in" X="0in" Y="25.33cm" ColumnCount="1" PaddingLeft="0in" PaddingRight="0in" PaddingTop="0in" PaddingBottom="0in" FlowIndex="1" Height="1.25cm" BorderTopStyle="solid" BorderTopWidth="1pt" BorderTopColor="#000000" VerticalAlign="middle" TextAlign="center" Width="15cm">
<Content>
<xhtml:html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xhtml:head>
</xhtml:head>
<xhtml:body>
<xhtml:p><MadCap:variable xhtml:name="System.PageNumber" />
</xhtml:p>
</xhtml:body>
</xhtml:html>
</Content>
</Frame>
</Page>
</PageStyles>
You do not have the required permissions to view the files attached to this post.
garyjgeoaccess
Sr. Propeller Head
Posts: 148
Joined: Mon Feb 16, 2009 3:23 pm

Re: PDF target printing half the TOC as single lines

Post by garyjgeoaccess »

I should've been more precise. Instead of the project TOC file. I thought it would be helpful to see the entire table of contents as it appears in a PDF.

Okay, so I thought can I troubleshoot using the TOC file that you attached? So I dumped it into a project, hooked up some topics to the first half dozen TOC entries, duplicated TOC code so the PDF document would run over 100 pages (and give me a long TOC in the PDF), used your code to create a page layout doc for the contents page, and then generated a PDF. And you know what? I got a good table of contents in the PDF.

I did notice something unusual about your page layout code: you've only specified a "first" page layout. Typically, if you just have one, it should be a "normal" page layout. So is this causing the problem? I doubt it. (I used your page layout code and got good PDF output.)

I also noticed some of your TOC entries are linked to a master page. Master pages aren't used by PDFs, but what happens if one is nonetheless linked to topics in the TOC? Don't know.

Not sure I'm helping much.

It'd still help to see your table of contents in a PDF (use Acrobat to extract just the TOC pages).
Graham Campbell
Propeller Head
Posts: 54
Joined: Tue Oct 30, 2007 4:40 am
Location: Glasgow, Scotland, UK

Re: PDF target printing half the TOC as single lines

Post by Graham Campbell »

UPDATE

I've been going back through this doc after a break away from it and I noticed that the single line issue only happens when my ToC stretches to more than a page. If I remove enough content such that the ToC fits in a single page, then it formats perfectly.

As soon as I add in enough content for the ToC to be longer than a single page, every entry in the ToC is printed on a brand new page UNTIL there's only enough entries left to fit in one page, which is when I get a single page of properly formatted ToC I mentioned earlier in the thread.

That said, I'm still no closer to figuring out why this happens. I'd be more than grateful if anyone still checking this thread would like to comment further.

Thanks,
Graham
Nita Beck
Senior Propellus Maximus
Posts: 3669
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: PDF target printing half the TOC as single lines

Post by Nita Beck »

None of my p.TOC1 etc. styles have any of the page-break attributes (before, after or inside) set.
Graham, have you checked to see that your TOC2 style doesn't have its page-break-before attribute set to avoid? That would make all of those TOC2 entries keep trying to avoid a page break, so the break would "bubble up" to the TOC1 immediately preceding them. Get what I mean? (I think I had a similar problem with subentries in an index once, and the "page-break-before: avoid" turned out to be the culprit.)

Nita
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Graham Campbell
Propeller Head
Posts: 54
Joined: Tue Oct 30, 2007 4:40 am
Location: Glasgow, Scotland, UK

Re: PDF target printing half the TOC as single lines

Post by Graham Campbell »

Nita,

Yes I do see what you're getting at, but unfortunately what you describe isn't quite the issue I'm suffering. Every entry, be it TOC1, TOC 2 or whatever, is printed on a new page until the last full page of properly formatted ToC content.

Going through this some more, I'm pretty convinced it is something to do with my styles - or a combination of my styles and a dodgy PageLayout - but nothing I can immediately see. If I don't style the ToC topic at all it prints a rather plain but otherwise perfect ToC listing. Explictly setting which CSS file to use in the HTML gives me my error.

I'll keep at it, but thanks for the suggestion.

Graham
bonnie
Sr. Propeller Head
Posts: 158
Joined: Wed May 14, 2008 4:00 pm

Re: PDF target printing half the TOC as single lines

Post by bonnie »

I was getting the same problem of single lines per page in my PDF TOC.

In my case, I had a TOC1 set to page-break-after:avoid. I removed that setting, which fixed the single-line problem.

One thing to be aware of is that the TOC levels are affected by the setting Use TOC depth for heading levels in the Printed Output part of the Target Editor. When TOC depth is NOT used to determine output TOC levels, the TOC1, TOC2, TOC3... styles are applied to h1, h2, and h3... styles, respectively (or whatever mc-heading-level is assigned to the tag under PrintSupport).

When I had Use TOC depth for heading levels selected, I was unable to affect the h3 heading levels by changing the TOC3 style in the style sheet, because my TOC depth only went down two levels. The h3 headings were in the document, but not as separate topics, so I couldn't break them out with the depth of the TOC. For some reason, which I' don't understand, the h3 headings were showing up in the TOC, but the TOC3 style was not being applied to them. (This threw me for awhile.)

Maybe something like this is happening to you. I.e., you THINK a TOC style is being applied when it is not because you are using TOC depth to determine heading levels in the output TOC.

Bonnie
Graham Campbell
Propeller Head
Posts: 54
Joined: Tue Oct 30, 2007 4:40 am
Location: Glasgow, Scotland, UK

Re: PDF target printing half the TOC as single lines

Post by Graham Campbell »

Bonnie wins the top prize. I did not know about the change of style use if Use TOC depth for heading levels is selected, so that was one part. Turned out to be a combination between that and the page-break-after: avoid style which I also had set.

Seems to me to be a bit odd that setting the page-break-after: avoid actually does create a new page for each entry. I'd have expected that to explictly NOT break on to a new page. *shrug*

Thanks everyone else for engaging with me in this - this fix has been a long time coming!

G
bonnie
Sr. Propeller Head
Posts: 158
Joined: Wed May 14, 2008 4:00 pm

Re: PDF target printing half the TOC as single lines

Post by bonnie »

Graham,
I'm pleased to find out that my solution worked for you.
Thanks for letting me know. (It made my day.)
I've had a lot of help and support on this forum myself.
Which is why I keep coming back to it over and over.
Bonnie
KatherineMunro
Jr. Propeller Head
Posts: 5
Joined: Wed Apr 28, 2021 10:49 pm

Re: PDF target printing half the TOC as single lines

Post by KatherineMunro »

It might seem a bit belated to reply, but Bonnie's solution helped me today with this scenario:
PDF TOC has only a single level, but has too many entries to fit onto one page. (It was a throw away doc for review PDF, and a nested structure of the TOC didn't make sense for this content.)

Various experiments led me to conclude that Flare 2021R2 still doesn't cope well with more than a single page of TOC items that are all at the same level.

Changing the Use TOC depth for heading levels setting in the PDF target Advanced tab had no affect. I still had a single TOC item per page until there were only enough left to fit on the the last page of the TOC.

Commenting out page-break-after: avoid; in the style sheet worked.
p.TOC1
{
font-weight: normal;
line-height: 21pt;
margin-bottom: 15px;
margin-top: 15px;
/* page-break-after: avoid; */
font-size: 12pt;
}

Thanks again, Bonnie and Graham, and everyone else who contributed suggestions. You saved me having to raise a support call.
Post Reply