Forum Bugs

Issue creating showing captions in TOC

talyrobin
Hi,

I am having issues showing the table captions when converting to PDF using PRINCE. I have attached the html file which shows correctly. But when it converts, it doesn't recognize the caption tag. Can you someone please help? Is this not supported by Prince?
  1. pdfissue.zip44.9 kB
mikeday
Is JavaScript enabled?
talyrobin
Yes, javascript is enabled. It actually executes the js as the table of contents is created using js. Plus I added comments to make sure it was being implemented. However, Prince (or at least when it is creating the PDF) doesn't seem to recognize the <caption> tag.
mikeday
I'm a little confused, what do you mean by it doesn't recognise the tag? The first <caption> in the document is "Pin Descriptions", and it seems to be showing up above the table as expected.
talyrobin
It shows in the HTML. But when I converted to PDF using Prince, it doesn't work. The javascript bascially searches through all the tables and checks for an captions. However, when executing using Prince it doesn't seem to recognize that it is a caption.

var tables = $('div > table'),
len = tables.length, fig = document.createElement('figure'),
who, temp;
if(tables.length > 0) {

while(len) {
temp = fig.cloneNode(false);
who = tables[--len];
capTemp = who.caption;
who.parentNode.insertBefore(temp, who);
content = document.createElement( 'figcaption' );
var capTemp = "";
if(who.caption != null) { <<------------------------------------this is NULL
capTemp += who.caption.innerHTML;
}
else {
capTemp += " No Captionaa :: " + who.caption;
}
content.innerHTML = "<b name='table' id='T" + (len+1) + "'><a href='#tabHome'>" +
"Table " + (len+1) + "</a> : " + capTemp + "</b><br><br>";
if(len > -1) {
temp.appendChild(content);
temp.appendChild(who);
}
}
mikeday
Oh right, it appears that we don't support the "caption" DOM property, and a number of other table-specific properties. But you can still access it with who.getElementsByTagName("caption"), it's just a bit longer to type. :)
talyrobin
Oh let me try that. Thanks!
talyrobin
Resolved! Thanks!!!