The UGLY side of FOP

I tracked down an issue for a customer with the default FOP PDF output from APEX. When you change the page to portrait layout the table would extended off the right side of the page.

What causes this issue is a hardcoded width for the table, width="658.8pt"

So how do you get around this, well simple you just remove it.

  1. Go to the Report Layout page

  2. Home > Application Builder > Application NNN > Shared Components > Report Layouts

  3. Choose Create Button

  4. Choose Generic Columns (XSL-FO)

  5. In Report Layout look for and remove this string width="658.8pt"

  6. Save the template and then apply it to your report in it's printing options tab.

It's pretty simple but can cause people some definite pain if you don't know where to look, and it will be removed in next version.

As you get more advanced another thing to look for is the page declaration in that same section.

Right now it is listed as this.

<:fo:simple-page-master master-name="master0" margin-left="66.6pt" margin-right="66.6pt" page-height="#PAGE_HEIGHT#pt" page-width="#PAGE_WIDTH#pt" margin-top="36.0pt" margin-bottom="36.0pt">

But if you need more exacting you can change to something like this.

<fo:simple-page-master master-name="master0" margin-left=".5in" margin-right=".5in" page-height="11in" page-width="8.5in" margin-top=".5in" margin-bottom=".5in">

As you can see I've hardcoded the widths and margins in instead of using the substitution variables. At the moment I'm a big fan of just creating your own edited default portrait and landscape templates as starters templates.

Plus it's a first step into getting into the UGLY world of editing raw FOP and XSL, and won't that be fun.


Post a Comment