Re: [Flying Saucer Users] Splitting wide tables across pages in pdf.

1,591 views
Skip to first unread message

Peter Brant

unread,
Jul 15, 2012, 1:56:42 PM7/15/12
to flying-sa...@googlegroups.com
There isn't any support for this in FS.  FS does support named pages so you could at least make the page(s) with the table use a potrait orientation (or a larger page size).

Pete

On Wed, Jul 11, 2012 at 2:09 PM, Justin Roderick <justinr...@googlemail.com> wrote:
I'm trying to work out if this is possible. Some of the HTML tables i need to convert to pdf are quite wide (would probable span 2-3 pages). Is there any way with flying saucer that it can cut the table up and wrap it across multiple pages rather than just stopping at the edge of one page, and the rest of the table doesn't get displayed? Having spent a few hours googling this i have had no luck, but maybe i'm just not sure what to google.

Many thanks.

Robert Vogel

unread,
Jul 19, 2012, 5:36:23 AM7/19/12
to flying-sa...@googlegroups.com
Hi Justin!

As Peter suggests I use the named pages feature of CSS. It works like this:

/*CSS*/
/*Default page definition*/
@page {
    size: A4 portrait;
    margin: 3.5cm 1cm 2.5cm 2.5cm;
    /*...*/
}

/*Named pages*/
@page rotated { size: landscape }
@page narrow { size: 9cm 18cm }
@page ultrawide { size: 58.4cm 21cm; }

.rotated {
    page: rotated;
    page-break-before: right;
    page-break-after: always;
}
       
.narrow {
    page: narrow;
    page-break-before: always;
    page-break-after: always;
}

.ultrawide {
    page: ultrawide;
    page-break-before: always;
    page-break-after: always;
}

<!-- HTML -->
<div class="ultrawide" />
    <table>
        <!-- a very wide table ... -->
    </table>
</div>


Greetings,
Robert
Reply all
Reply to author
Forward
0 new messages