0

I'm using fop libraries v1.1 to produce a pdf, and I noted that fop by default collapse white-spaces inside strings. For example a block like:

<fo:block>
  Sample                   Text
</fo:block>

Render as

Sample text

eliminating whitespaces. I would like to keep strings inner whitespaces in the generated pdf, so I tried to use the white-space="pre" attribute inside the block tag, but it preserves only white-spaces outside the string.

Then I tried to use the white-space-treatment="preserve" attribute inside the block tag, but the rendered page had collapsed white-spaces.

Finally I tried to use the white-space-collapse="false" attribute inside the block, and also in this case the rendered page had collapsed white-spaces.

Why fop is collapsing by default white-spaces inside strings? Is there a way to change the fop behaviour in order to preserve white-spaces inside strings?

avalori
  • 427
  • 2
  • 5
  • 17
  • I cannot reproduce this. `white-space="pre"` works for me. Can you please explain what you are doing in more detail? How are you creating the XSL-FO markup? – mzjn May 09 '13 at 21:16

1 Answers1

0

white-space="pre" should work here or you may use linefeed-treatment = "preserve", white-space-collapse = "false", white-space-treatment = "preserve", wrap-option = "no-wrap" which are equal to white-space="pre". For more information you may also visit http://www.learn-xsl-fo-tutorial.com/Blocks-Inlines.cfm#h1.6

Navin Rawat
  • 3,208
  • 1
  • 19
  • 31