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

From
David Cramer <>
Date
2014-01-06T15:09:16+00:00
ID
Thread
Re: [docbook-apps] Fitting tall images in PDF
Hi Mark,
I'd edit the fo and run it through your fo processor to confirm that
scale-down-to-fit gives the result you want.

For production you'll want to customize the templates from graphics.xsl
to make the right stuff come out in the fo. In particular the templates
<xsl:template name="image.content.width"> and <xsl:template
name="image.content.height"> are important.

Really this should be a feature of the stock xslts though.

Regards,
David

On 01/05/2014 03:58 AM, Mark Craig wrote:
> 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