W3C home > Mailing lists > Public > www-xsl-fo@w3.org > April 2004

Scaling external-graphic with XEP 3.7.5

From: MJ Suhonos <msuhonos@uhnres.utoronto.ca>
Date: Fri, 30 Apr 2004 13:46:54 -0400
Message-ID: <4092910E.40508@uhnres.utoronto.ca>
To: www-xsl-fo@w3.org
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-row keep-with-next="always">
<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-row keep-with-previous="always">
<fo:block text-align="center" span="all">
content-width="auto" content-height="auto" width="auto" height="auto"/>
<fo:table-row keep-with-previous="always">

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:

Any help is gratefully appreciated!


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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:10:00 UTC