What does reference-orientation really do?

2019-06-21 05:24发布

问题:

I have to render a pfd using FOP, and some images mst be rotated. The result however doesn't look the way I expect it to be. So, here is my question (and I somehow wasn't able to find a good documentation to clarify this issue for me):

If I define

fo:block-container reference-orientation="90" width="100" height="200"

will this rotate the whole container (leading effectively to a rendered box of dimension 200x100), or will it merely rotate the content of the container (leaving the container itself to be rendered with dimensions 100x200)?

回答1:

It will rotate the entire container.

Here's an example of the width being less than the height and then rotated 90deg...

XSL-FO

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="my-page" page-width="8.5in" page-height="11in">
            <fo:region-body margin="1in" margin-top="1.5in" margin-bottom="1.5in"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="my-page">
        <fo:flow flow-name="xsl-region-body">
            <fo:block-container reference-orientation="90" width="3in" height="7in" background-color="black" padding="4pt">
                <fo:block color="white">Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn't commit. These men promptly escaped
                    from a maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.
                    If you have a problem and no one else can help, and if you can find them, maybe you can hire the A-team.</fo:block>
            </fo:block-container>
        </fo:flow>
    </fo:page-sequence>
</fo:root>

PDF Output (Using FOP 1.0)