Elrond
Elrond

Reputation: 499

xsl:fo How to draw checkboxes

guys I need a checkboxes in my xsl:fo document and so the question, is their a way in fo ,or need I an picture(graphic) ?

I use FOP and xslt 2.0

Here is a picture of the checkbox enter image description here

Upvotes: 4

Views: 6128

Answers (4)

Turo
Turo

Reputation: 4924

Another way I came across this days is spaces(or with an 'x' if checked) with a border

    <inline font-size="80%" vertical-align="10%" border-style="inset">&#160;&#160;  </inline>
    <inline font-weight="bold" font-size="80%" vertical-align="10%" border-style="inset">&#160;x </inline>

Upvotes: 0

user3577528
user3577528

Reputation: 41

I tried fonts and they did work well while testing with Oxygen in MS-Windows but when I run the scrip in the Linux server we have, it couldn't handle the fonts and printed the number sign instead. I have to find out if there are other fonts that could give similar results, other wise I would need to use ugly tables.

Using pictures was at first a good idea, but then I realized that they do not take the background color when it is different than blank; unless there is a way to have a kind of picture (perhaps gif) and xslfo instruction to enable a see through.

Upvotes: -1

Hobbes
Hobbes

Reputation: 2125

Using a font that contains a checkbox image is one way (Wingdings has a few checkboxes). But you can also place SVG code in your FO template.

Example for a 5x5 mm rectangle (off the top of my head, needs checking):

<fo:block>
    <fo:instream-foreign-object>
        <svg width="5" height="5">
            <rect width="5" height="5" style="stroke-width:0.5;stroke:rgb(0,0,0)" />
        </svg> 
    </fo:instream-foreign-object>
</fo:block>

And you need to declare the svg namespace in your FO template: xmlns="http://www.w3.org/2000/svg"

Upvotes: 5

Kevin Brown
Kevin Brown

Reputation: 8877

Those are characters available in several fonts. Check MS Gothic.

Upvotes: 2

Related Questions