7

I working on a visualforce page (running a tabular report) with a table (13 columns) and am rendering a PDF as well for this.

Firstly, all the columns are not fitting in a single PDF. Secondly, how do I turn the PDF into a landscape mode, like a full width of the browser. Thirdly, is there a way through which I could render in multiple PDFs for the single VF page (the 13 columns coming in probably 2 PDFs).

Any suggestion on how to achieve these.

4

Firstly, all the columns are not fitting in a single PDF.

Use fewer columns, a smaller font, or some other design, such as a multi-line row. You can't go as wide as you'd like, that's a limitation of Flying Saucer, the underlying rendering engine.

Secondly, how do I turn the PDF into a landscape mode, like a full width of the browser.

Use the following CSS:

@page { size: A4 landscape; }

Thirdly, is there a way through which I could render in multiple PDFs for the single VF page (the 13 columns coming in probably 2 PDFs).

You can render as many PDFs as you'd like, assuming you don't run into other limits, such as CPU time. If each row is the same height, you could render the table in two parts, say 7 columns and 6 columns. You can use the CSS page-break-after: always to effectively re-align the tables without much effort. It would look like:

<div style="page-break-after: always">
    <!-- render first 7 columns -->
</div>
<div>
    <!-- render last 6 columns -->
</div>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.