Preserving whitespace in PDF after XSL transform Preserving whitespace in PDF after XSL transform xml xml

Preserving whitespace in PDF after XSL transform


Add the attribute white-space="pre" to whatever fo:block you want to preserve the white-space in.

Example:

<fo:block white-space="pre">Test Line Data         : 0xAA</fo:block>

The attribute white-space-treatment="preserve" should also work, but when I tried it in FOP, it didn't.

The attribute white-space-collapse="false" also worked.


I found the answer. http://groups.yahoo.com/group/XSL-FO/message/4128 When I put white-space-collapse="false" in fo:block, the whitespace is preserved.


You can use space-after=5mm in the fo block tag. Example

<fo:block space-after=5mm>Something</fo-block><fo:block>SomethingSomething</fo:block>

The first line will create space of 5 mm after the text "Something".