Search code examples
svgxsl-foapache-fop

SVG Rect Height to Match fo:block height


This is a shot in the dark, but is there a way to set the svg rect height based on the fo:block height?

I've got a design where the client assumes the static graphic can scale in a fo:table-row where text is wrapping. The static graphic has a very particular shape.

I'm trying to find a solution to scale the graphic height based on it's parent.


Solution

  • If you are trying to place a scaled background image behind a block in the table-cell (question was unclear) ... you can do so using RenderX XEP with their extensions for background-images.

    See http://www.renderx.com/reference.html#Background_Image

    Sample:

      <fo:table>
            <fo:table-column column-width="1in"/>
            <fo:table-column column-width="1in"/>
            <fo:table-column column-width="1in"/>
            <fo:table-body>
                <fo:table-row >
                    <fo:table-cell>
                        <fo:block background-repeat="no-repeat" background-position="center center" background-image="circles1.svg" rx:background-content-height="scale-to-fit" rx:background-content-width="scale-to-fit" rx:background-scaling="non-uniform">This is some flowing stuff. This is some flowing stuff. This is some flowing stuff. This is some flowing stuff. </fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block background-repeat="no-repeat" background-position="center center" background-image="circles1.svg" rx:background-content-height="scale-to-fit" rx:background-content-width="scale-to-fit" rx:background-scaling="non-uniform">This is some flowing stuff. </fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block background-repeat="no-repeat" background-position="center center" background-image="circles1.svg" rx:background-content-height="scale-to-fit" rx:background-content-width="scale-to-fit" rx:background-scaling="non-uniform"> This is some flowing stuff. This is some flowing stuff. This is some flowing stuff. This is some flowing stuff. This is some flowing stuff. This is some flowing stuff. This is some flowing stuff. This is some flowing stuff. </fo:block>
                    </fo:table-cell>
                </fo:table-row>
            </fo:table-body>
        </fo:table>
    

    Result:

    enter image description here