Re: [docbook-apps] Fitting tall images in PDF

From
Mark Craig <>
Date
2014-01-05T09:59:02+00:00
ID
CACFdy_8xUmXcqVGZ_ogTAUwbMLAPfp0KAuc4WNJTw5=
Thread
Re: [docbook-apps] Fitting tall images in PDF
Thanks Bob and David,

What's the right way to pass the "scale-down-to-fit" attribute value into the FO?

I've tried adding them as attributes on <imagedata> with some XSL that I was using before to handle wide images. Here's the template where xmlns:db="http://docbook.org/ns/docbook" exclude-result-prefixes="db":

 <xsl:template match="db:imagedata">

  <xsl:element name="imagedata" namespace="http://docbook.org/ns/docbook">

   <xsl:apply-templates select="node()|@*"/>

   <xsl:attribute name="contentdepth">scale-down-to-fit</xsl:attribute>

   <xsl:attribute name="contentwidth">scale-down-to-fit</xsl:attribute>

   <xsl:attribute name="align">center</xsl:attribute>

  </xsl:element>

 </xsl:template>

After this transformation and running the stylesheets, text-align="center" shows up in the resulting .fo, but the others are null: content-width="" content-height="".

Is there a stylesheet customization I should apply to allow those attribute values to pass through to the FO?

Or do I need to edit the FO after it gets generated?

Regards,

Mark

On Sat, Jan 4, 2014 at 6:30 PM, David Cramer <> wrote:

What about setting content-width and content-height in the fo to

scale-down-to-fit? Should be supported in fop and xep; not sure about

antenna house:

http://apache-fop.1065347.n5.nabble.com/scale-image-if-too-large-td14003.html#a14005

Regards,

David

On 01/03/2014 04:35 PM, Bob Stayton wrote:

> Hi Mark,

> I'm not sure you can do that with XSL-FO.  It works for width because an

> image is not competing with other content for width space.  So defining

> width="100%" means the dedicated viewport is 100% of the width of the

> page between margins, and the image is located within that viewport,

> sized down to fit if necessary.

>

> If you set depth="100%", you are creating a viewport that is the height

> of the remaining space on the page, not the whole page.  So the height

> of that viewport depends on what precedes the image on the page.