Dropdown heads and PDF styles

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
Oda
Propeller Head
Posts: 48
Joined: Tue Apr 15, 2014 6:04 am

Dropdown heads and PDF styles

Post by Oda »

Hi,

I have a project that needs to be generated in HTML5 and in PDF.
For the HTML5 ouput, there are some sections where I use dropdown texts.
For the PDF output, I want these sections to appear normally, with an H2 style applied to what corresponds to dropdown heads of the HTML5 output, but can't find the info to do that. It takes a default style coming from I-dont-know-where.
Any idea?

Thanks
patrishmo
Jr. Propeller Head
Posts: 8
Joined: Wed Apr 23, 2014 11:20 am

Re: Dropdown heads and PDF styles

Post by patrishmo »

I accomplished this by applying conditional text to the heading that I wanted to show in the PDF. If the h2 heading is the heading that you want to show, set that as conditional text for print only. When you build the PDF, check of to include the print only conditional text in your print target.
wclass
Propellus Maximus
Posts: 1238
Joined: Mon Feb 27, 2006 5:56 am
Location: Melbourne, Australia

Re: Dropdown heads and PDF styles

Post by wclass »

I use an output medium and set the css values for the following styles. You can make it look like the H2 but I don't think you can specify that it is assigned the H2 style (a CSS expert might jump in here).

MadCap|dropDownHead
MadCap|dropDownHotspot
Margaret Hassall - Melbourne
Msquared
Propellus Maximus
Posts: 848
Joined: Mon Aug 06, 2012 10:19 am
Location: Southampton, UK

Re: Dropdown heads and PDF styles

Post by Msquared »

Yes you can assign an H2 style. I do all my styles by editing the CSS file directly, so I just defined
MadCap|dropDownHead.h2
MadCap|dropDownHead.h3 etc
and copied the h2, h3 style definitions for the PDF.

Big, big, big BUT . . . .

In theory this should work beautifully, and make single sourcing Web/PDF output a breeze, without the need for web/print conditionals or anything else. In practice this is *unbelievably* buggy and I must admit to being very disappointed with the PDF output from the drop-down heading styles. I've reported many bugs, some of which make my output look so awful that I have indeed not been able to do this as I had planned above.

Major bugs are:
  • The auto-numbering positioning for the heading levels just doesn't work. If you use auto-numbering, check you are happy with the PDF output before you go ahead and do lots of the same.
  • Pagination is poor. It seems that the drop-down body attempts to bind the content more tightly than your attempts to keep heading levels with the text that follows. I've tried all sorts of things to force this not to be the case. But typically, you can expect to get page breaks thrown where they are not needed (the heading and some of the body text could fit on one page before the page break, but it doesn't) or widow headings at the bottom of a page.
  • PDF bookmarks lose the auto-numbers for the drop-down head items
  • PDF bookmarks can appear in the wrong order for the drop-down items although they point to the correct locations (for example a level 3 bookmark may appear below the level 2 bookmark above where it really belongs).
In the end, this is what I did.
  • I used the drop-down head for the web as normal - works well.
  • I also added the appropriate level N heading immediately below it, with exactly the same text
  • I set a print style for the drop-down head to be invisible text and tiny (1px high), so it is effectively not there - due to another bug, this is far easier than messing around with print/web conditionals for drop-down heads.
  • I created a "template" snippet to add a blank one of these, which I convert to text when I place it. That way, I'm sure I've set it up correctly.
I still have widow headings at the bottom of some pages and have eventually got MadCap to agree this is a bug.

There is one good thing about having the print headings inside the drop-downs and that is the fact that if you want to xref to a drop-down in the web output, the drop-down will not expand unless you xref into the drop-down body, rather than to the drop-down head. So the print headings give me a target for xrefs, and for the PDF output, the xref will include the auto-number on the heading as usual. Since this text duplicates the drop-down header in the web output, you may want to make these heading style tiny and invisible in the web output, in the same way as I made the drop-down headings tiny and invisible in the print output. The bookmark will still work. But I decided to leave them visible, since it's a useful navigation aid for the reader when an xref jumps them into a drop-down as the drop-down heading will often be off the top of the screen.

More bugs.
  • If you do want to conditionalize the drop-down head (for example to be web-only) you need to set the condition on the drop-down hotspot but the only way the Flare editor lets you do it is on the containing drop-down header. Or perhaps it's the other way round? In any case, you need to apply conditions directly in the XML code to get them to work for print/web as however the Flare editor applies them doesn't give the required result.
  • When you edit your drop-down content, you can only access styles of the CSS tag your text is in. So if you have a <p> tag, you can change it to another <p> style, but not to an <h2> style without editing the XML directly. Similarly if you have a <h2> style, you can't make it <h3>. Fortunately I found a work-around for this, and that's to wrap the whole drop-down body in a <div>. So that's in my snippet template for drop-downs too.
Come on MadCap - It really shouldn't be this difficult. :-(
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
dorcutt
Sr. Propeller Head
Posts: 234
Joined: Thu May 15, 2014 12:16 pm

Re: Dropdown heads and PDF styles

Post by dorcutt »

Submitted a feature request to make this work using only mediums and not these incredibly well-developed workarounds.

Msquared, thanks for taking the time to share your knowledge on this topic! All of this knowledge was clearly learned at a great cost of time and annoyance.
-Dan, Propellerhead-in-training
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Dropdown heads and PDF styles

Post by NorthEast »

dorcutt wrote:Submitted a feature request to make this work using only mediums and not these incredibly well-developed workarounds.
Unless I've missed something, it does work using only mediums; just style the dropDownHead the way you want it to appear in the appropriate medium. Note that you'll probably want to style the the dropDownHotspot too.

That'll work fine if you just want it to look like other headings.

If you actually need it to be a heading style (e.g. h1, h2), rather than just look like one - then use a toggler, not a dropdown. Just create a normal heading and set it up as a toggler for the content you want to display; in the PDF output, the toggler content is displayed as normal (like the dropdown body).

Msquared - I would guess that your scenario might be a lot easier using togglers, rather than using dropdowns with elaborate workarounds.
Msquared
Propellus Maximus
Posts: 848
Joined: Mon Aug 06, 2012 10:19 am
Location: Southampton, UK

Re: Dropdown heads and PDF styles

Post by Msquared »

Msquared - I would guess that your scenario might be a lot easier using togglers, rather than using dropdowns with elaborate workarounds
Thanks. Will try those when I get a minute. I've not really got into togglers - for some reason I decided they weren't what I needed.

I'm in a bit of a lull between releases right now, and so far I have managed to get Global Project Linking working (at last, and not without some pain), and set up some proper project templates. Oh, and report lots of bugs, so I guess I'm not MadCap Support's favourite person at present. :-)
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
Oda
Propeller Head
Posts: 48
Joined: Tue Apr 15, 2014 6:04 am

Re: Dropdown heads and PDF styles

Post by Oda »

Thanks all for your answers. For my part, setting the dropdownhead for print medium seemed to work (I first thought dropdown styles could only be set fo web outputs). However, I had a formating parameter which wouldn't apply, but I sorted it out by setting also the dropdownhotspot style.
Amanda_Wood
Jr. Propeller Head
Posts: 2
Joined: Fri Dec 16, 2016 5:08 am

Re: Dropdown heads and PDF styles

Post by Amanda_Wood »

I am struggling with this same issue in October 2017. The PDF page breaks are a pain in the biggest....and I have not figured out how to fix it so I gave up. I tried creating a Div with avoiding inside page breaks, but this does not work well. I see all the other work arounds below, and I am not prepared to do this since it is 3 years later and obviously this bug is not considered important. But it is. I want drop downs in the HTML...wonderful things, but when I generate all the PDFs they look terrible.

[*]Pagination is poor. It seems that the drop-down body attempts to bind the content more tightly than your attempts to keep heading levels with the text that follows. I've tried all sorts of things to force this not to be the case. But typically, you can expect to get page breaks thrown where they are not needed (the heading and some of the body text could fit on one page before the page break, but it doesn't) or widow headings at the bottom of a page.
TWAnnie
Jr. Propeller Head
Posts: 9
Joined: Wed Jan 18, 2017 7:39 am

Re: Dropdown heads and PDF styles

Post by TWAnnie »

I've given up as well, and I've switched to togglers. It keeps my pagination in the PDF as it should be and looks just like a drop-down in HTML5 output. And the collapse/expand all button works on it as well.

A drawback: a toggler collapses/expands only one element (one <p>, one <table>, one <div>...) and you have to name these elements. A little bit of extra work, but worth the effort.
I use togglers for my numbered step procedures - they are already in a div, I just give the divs a name. Same goes for tables. And I just put a class-less div around anything else I want to collapse.
I use a separate paragraph (condition: online only, not in print) that you can click to toggle the content.

For example - this toggler expands/collapses the div named "pr_logon":

<p MadCap:conditions="HTML_PDF.ScreenOnly">
<MadCap:toggler targets="pr_logon">To log on to application x:</MadCap:toggler>
</p>
<div class="numbered" MadCap:targetName="pr_logon">
<p class="numbered_intro>To log on to application x, proceed as follows:</p>
<p class="numbered>Step 1</p>
<p class="numbered>Step 2</p>
</div>

Minor drawback: when you expand the content in the online version, you see almost the same text in the toggle link and in the first line of the expanded div, but nobody's complained so far.

Advantage: there is only one extra style in my css, for:
MadCap|toggler:link

Bonus: the number of grey hairs on my head has also stabilised. :D
Good luck and good writing!
TWAnnie
Post Reply