We're starting to migrate our report-printing and such (forms included) to pdf - using xml files and nFOP with asp.net. In this case I have to print out a form which contains a whole lot of checkboxes, so I made 2 gifs of 12x12 pixels that represent the empty and checked states. Because I use so many checkboxes, I thought about making a template with a parameter wether it should be checked or not (if the xml contains any data, otherwise everything will be blank - we have to offer both possibilities). Here's what the template looks like (I had content-width and content-height, and width and height set at some point. All the same apparently)
Expand|Select|Wrap|Line Numbers
- <xsl:template name="checkbox">
- <xsl:param name="checked" />
- <xsl:choose>
- <xsl:when test="$checked='false'">
- <fo:external-graphic src="url('http://krokador.freepgs.com/checkboxOff.gif')"/>
- </xsl:when>
- <xsl:when test="$checked='true'">
- <fo:external-graphic src="url('http://krokador.freepgs.com/checkboxOn.gif')" />
- </xsl:when>
- </xsl:choose>
- </xsl:template>
Expand|Select|Wrap|Line Numbers
- <fo:table-cell padding-top="2px">
- <fo:block>
- <xsl:call-template name="checkbox">
- <xsl:with-param name="checked" select="'false'" />
- </xsl:call-template>
- </fo:block>
- </fo:table-cell>
As long as its inline, the result is alright. The checkboxes will display a tad under the text level (due to the disposition of form - originally made in word - I can't use tables and put the image in a block, it would just make the structure complicated, hard to maintain, and in the end it probably would turn out just as ugly) but i can deal with that. However, if I try to shoot the textbox in a table-cell (inside of a block - like my previous code snippet) and alone, all hell breaks loose and the images display where they shouldn't be. Here's a picture to show you the problem (I added a border to the cell where the top left square is, or should be)
I would've wanted to do that and I don't think I would've managed! The checkboxes should be displaying level with the line on the left as they are in the same table-row... so why are they sticking on the top-left corner?
I have tried so many things, from a <fo:inline-container> with all sorts of positioning (alignment-adjust, alignment-baseline... etc) to putting the image inside of a floating block... I'm not quite sure what all I am supposed to do - or try - anymore. I also tried the image alone without the template: same results. the only change i can create is by adding a padding-top to the block that containts said checkbox (equal to its height) I can make it go down to its normal level. It's still way offset to the left and padding-left won't change a thing. Margin-left on the block somehow stretches the image, so im leaving that one out (and even with width and height specified). Has anyone ever come across something like this? Or does anyone have a different idea on how I would render these? Nothing seems to work. :(:confused:
Thank you in advance for your time