[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Scaling external-graphic with XEP 3.7.5

Subject: Scaling external-graphic with XEP 3.7.5
From: MJ Suhonos <msuhonos@xxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Apr 2004 13:53:40 -0400
fo external graphic size
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.