I'm trying to align a text next to an SVG image insde an XSL which then is used to create a pdf.
This is where I have both text and SVG set up:
<fo:block font-size="14pt" text-align="center" margin-top="2cm">
<fo:instream-foreign-object>
<svg:svg width="30" height="30" xml:space="preserve">
<svg:g style="fill:none; stroke:black; stroke-width:1">
<svg:rect x="0" y="0" width="30" height="30"/>
</svg:g>
</svg:svg>
</fo:instream-foreign-object>
Mark If Closed
</fo:block>
This is the output:
I want the text "Mark If Closed" to be vertically in the middle with the square SVG.
If the size of the square is constant, you could play with baseline-shift. Given SVG height of 30 and font-size of 14pt, a baseline-shift of about 5pt would do it.
<fo:block font-size="14pt" text-align="center" background-color="silver">
<fo:instream-foreign-object>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="30" height="30" xml:space="preserve">
<svg:g style="fill:none; stroke:black; stroke-width:1">
<svg:rect x="0" y="0" width="30" height="30"/>
</svg:g>
</svg:svg>
</fo:instream-foreign-object><fo:inline background-color="yellow" baseline-shift="5pt">Mark If Closed</fo:inline></fo:block>
Yields this (color added for clarity):