Scaling external-graphic with XEP 3.7.5

Hi all,

I'm trying to include images in a PDF document being generated using 
XSL:FO and XEP 3.7.5.  The difficulty I'm having is because I don't know 
the image format or size before doing the render, so it has to be done 
automatically in the XSL-FO pass.  Images can be anywhere from 100x100px 
to 1000x1000px.

XEP handles the format fine (for the most part), but scaling is 
unpredictable, even (or particularly) using width="auto" height="auto" 
content-width="auto" content-height="auto".  What I am trying to do is 
scale down large images to fit within the width of my page, and keep 
small images their original size (or a reasonable size) - strangely I 
seem to be having more problems with small images scaling too large 
rather than vice-versa.

This seems to be a case for using the scale-to-fit value 
(http://xep.xattic.com/xep/testsuite/usecases/image-scale.pdf), but my 
difficulty is that while I know the absolute width the area I want the 
image to appear (19cm), I know neither the height (since this should be 
dependent on the scaled image), and I'm having problems with the image 
overflowing outside of the block.

The pertinent part of the FO for my example is:
(full XSL-FO available, it's just very large)

<fo:block space-after.optimum="6pt" space-before.optimum="6pt" span="all">
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-body>
<fo:table-row keep-with-next="always">
<fo:table-cell>
<fo:block id="figure1" span="all" font-size="8.5pt">
<fo:inline font-weight="bold">Figure 1: </fo:inline>Simple EAV schema 
for a clinical database.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row keep-with-previous="always">
<fo:table-cell>
<fo:block text-align="center" span="all">
<fo:external-graphic 
src="url(file:y:/jmir/jmir-cocoon/content/v5/v5e27/jmir_v5e27_fig1.jpg)" 
content-width="auto" content-height="auto" width="auto" height="auto"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row keep-with-previous="always">
<fo:table-cell/>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>

I have the image and caption in a blind table to keep them together 
across page-breaks (yes, I know this is ugly but it was the best way I 
could ensure consistent layout).  Should I be using a block-container 
instead/as well?

Full XML/PDF sources at:
http://ehealthresearch.ca/cocoon/jmir/v5e27.xml
http://ehealthresearch.ca/cocoon/jmir/v5e27.pdf

Any help is gratefully appreciated!
MJ

References:
http://xep.xattic.com/xep/testsuite/usecasestest.html
http://xep.xattic.com/xep/doc/tutorial.html#Graphics
http://xep.xattic.com/xep/doc/spec.html#Graphic_Formats

Received on Friday, 30 April 2004 13:48:20 UTC