Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Stylesheet export to PDF for tables

Vadim Belyakov January 10, 2013

Hello!

Anybody know how to get the PDF exporter to repeat the table headers when a table breaks across a page?

Also i have a problem with alignment of columns in width.

How to fix it in stylesheet?

8 answers

1 accepted

1 vote
Answer accepted
Nils Bier _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2013

Hi Vadim,

I did just reproduce your problem using the Scroll PDF Exporter described above (https://marketplace.atlassian.com/plugins/com.k15t.scroll.scroll-pdf) and inserted the CSS code in the Scroll PDF Exporter Content Formatting section. The table header was repeated on every break across a page.

Using the internal PDF exporter from Confluence, the repeating of the header doesn't work.

Did you use the Scroll PDF Export, or the Confluence PDF export function?

Maybe you should take a look in the Scroll PDF Exporter documentation (http://www.k15t.com/display/PDF/Documentation) to check the possibilities of this Add-On.

Cheers,

Nils

1 vote
Vadim Belyakov January 12, 2013

Atlassian Confluence 4.2.8

0 votes
Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2013

@Jens:

Did you mean that you have a solution for repeated headers that also works for confluence and not only for the Scroll PDF Exporter? That is how I understand your post.

But I just tried all the solutions presented here and nothing worked:

CharlesH solution:

div.tablewrap table.confluenceTable {
  -fs-table-paginate: paginate;
  border-collapse: separate;
  border: 1px solid #DDDDDD;
}

Your workaround:

table.confluenceTable {
  border-collapse: separate;
  -fs-table-paginate: paginate;
  border-spacing: 0px;
}

The solution copied from https://k15t.jira.com/browse/PDF-333

table {
 -fs-table-paginate: paginate;  
}

div.tablewrap table {
  border-collapse: separate;
  -fs-table-paginate: paginate;
  border-spacing: 0px;
}

Did you get it to work with one these solutions?

Jens Rutschmann _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 3, 2013

Hi Steffen,

I have not tried the workaround with the internal PDF Exporter, but since it also uses flying-saucer I'm pretty confident that it will work given that the CSS classes from the selectors match the HTML.

In our Scroll PDF Exporter the HTML looks a bit different, so the selector from our workaound might not match when you apply this CSS to the built-in PDF exporter's stylesheet without adaption.

Also make sure that there is no other CSS conflicting with the workaround.

Btw. this part is not required:

table {
 -fs-table-paginate: paginate; 
}

Cheers,
Jens

David Hergert _PAYX_ February 5, 2014

I have not been able to get the internal Export to PDF to repeat headers, in any browser with any custom CSS (as of Confluence 5.2.3). And I am sure the Scroll PDF works but we do not own that plugin at this time.

However, Confluence does output the "thead" element, which browsers should respect when printing normally (there is a 6 yr old WebKit bug #17205 that prevents Chrome from working). So in Firefox or IE, if I click Print Preview, it repeats the table headers and then I can Print to PDF and that works.

I've officially found the first reason to not use Chrome for everything. :)

Erik Söderström April 23, 2014

Like Steffen Heller said a year ago, none of the suggested solutions work for the internal PDF Exporter in Confluence. I just tried them all in Confluence 5.4, and nothing happens. No repeating table headers.

Has anyone been able to find something that works?

Lorenzo Cappelletti June 19, 2014

No luck with Confluence 5.5, neither. None of the suggested solutions work for the internal PDF Exporter.

Cheryl Schmelzer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2014

I have been unsuccessful with getting table headers to repeat also, using the internal PDF Exporter. Any updates on this issue? Thank you.

0 votes
Jens Rutschmann _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 19, 2013

Hi,

you may try this workaround adapted to the internal PDF exporter:

table.confluenceTable {
  border-collapse: separate;
  -fs-table-paginate: paginate;
  border-spacing: 0px;
}

We've also documented this here: https://k15t.jira.com/browse/PDF-333

The workaround there works with the Scroll PDF Exporter, so the adapted version should work for the internal one as well.

Cheers,
Jens

0 votes
Vadim Belyakov January 17, 2013

other solutions?

0 votes
CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 12, 2013

I expect you're using the standard Confluence export to PDF feature, but even so, you might try this tweak offered for the Scroll PDF Exporter plugin (http://www.k15t.com/pages/viewpage.action?pageId=11078043):

div.tablewrap table.confluenceTable {
  -fs-table-paginate: paginate;
  border-collapse: separate;
  border: 1px solid #DDDDDD;
}

This should go in the CSS for PDF Export.

The "-fs-table-paginate" part relates to Flying Saucer, which is a XHTML renderer and used by Confluence to create the PDF output. I think the Scroll PDF Exporer also uses it, so there's a good chance this will work for you.

Vadim Belyakov January 13, 2013

Unfortunately, it did not help

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2013

I am having the same problem. I tried the tweak with "-fs-table-paginate: paginate;" as described above and the normal CSS solution with

table thead {
display: table-header-group;
}

But it didn't work.

Also, I am wondering if the confluence 4.x table code is the problem. When I include a standard table from the menu it creates a table with the following html code:

<table class="confluenceTable">
<tbody>
<tr>
<th class="confluenceTh">...</th>
<th>...

Wouldn't it have to be <thead> instead of <tbody> and couldn't this be one more reason why it doesn't work?

Or did someone achieve repeating headers with confluence 4.x?

Thanks, Steffen

Nils Bier _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2013

Hi Steffen,

concerning your problem with the repeating header, did you try it with the standard PDF Export in Confluence or with the Scroll PDF Exporter?

Cheers, Nils

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2013

Hi Nils,

the standard PDF Export.

I know that your plugins are better and offer more, but for this rather simple thing I would like to get it running with confluence alone.

Though the list gets longer and at a certain point I might reconsider because of better TOC, automatic cross references, more flexible PDF output ...

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2013

Hello everyone:

please forget what I wrote starting with "Also, I am wondering if the confluence 4.x table code is the problem..."

I tried again and everything seems okay with <thead> and <tbody>. No problem here.

----

PS: Couldn't edit the comment itself since I exceeded the allowed time frame ;-)

0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 11, 2013

What product are you referring too?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events