Search code examples
xsl-foapache-fop

xsl fo fo block visibility not working


If I set the attribute visibility="hidden" it has no effect on the element fo:block.

<fo:block visibility="hidden">Download:</fo:block>

It would be show in the document.

Any suggestions?

Thanks.


Solution

  • If visibility is not supported by your FO engine, you could use

    <fo:block color="white">
    

    (or whatever color matches the background color). If you use white and the output will be printed by a full-color printer, you may have to tweak the PDF so you don't waste money printing the white text.

    With this method, the text will still be in the PDF, and may possibly be extractable.
    If you want to avoid that, you could create a custom font where every character is rendered as a space. Then specify your block to use this font.