DocBook <imagedata/> and scalefit attribute

Here should go questions about transforming XML with XSLT and FOP.
dnedrow
Posts: 60

DocBook <imagedata/> and scalefit attribute

Thu Jun 09, 2005 10:03 pm

Is there a [relatively] simple means of defining the viewport size of an <imagedata/> tag to the size of another element, possibly the enclosing element?

For example, in PDF output, I want the image scaled to fit the size of <figure/>, or, at the worst, <para/>. Anyway to handle this for the sample shown below?

Code: Select all

   <para>Test
    <figure>
     <title>Static Web</title>
     <mediaobject>
      <imageobject role="html">
       <imagedata fileref="diagrams/static.png"/>
      </imageobject>
      <imageobject role="fo">
       <imagedata format="PDF" fileref="diagrams/static.pdf"/>
      </imageobject>
     </mediaobject>
    </figure>
   </para>


-David
george
Site Admin
Posts: 2100

Fri Jun 10, 2005 11:29 am

Hi David,

I noticed you posted this on the xsl list, I think you have better chances to get a response on the docbook-apps list:

http://lists.oasis-open.org/archives/docbook-apps/
http://lists.oasis-open.org/

If someone here will know how to do what you asked we will surely post a reply.

Best Regards,
George
dnedrow
Posts: 60

Fri Jun 10, 2005 2:04 pm

george wrote:I noticed you posted this on the xsl list, I think you have better chances to get a response on the docbook-apps list:


Good idea. I had forgotten about docbook-apps. Since this was more of a presentation issue, I hesitated to post to the main docbook list.

-David
dnedrow
Posts: 60

Tue Jun 14, 2005 3:44 am

Paul A. Hoadley wrote:I think what you want to do is described in Bob Stayton's book here:

http://www.sagehill.net/docbookxsl/ImageSizing.html

In particular:

To keep a graphic for printed output at its natural size unless it
is too large to fit the available width, in which case shrink it to
fit, use scalefit="1", width="100%", and contentdepth="100%"
attributes.


This did work using the updated fo/graphics.xsl.

Eg.

Code: Select all

   <para>
    <figure>
     <title>Static Web</title>
     <mediaobject>
      <imageobject role="html">
       <imagedata fileref="diagrams/static.png"/>
      </imageobject>
      <imageobject role="fo">
       <imagedata scalefit="1" width="100%" contentdepth="100%"
        format="PDF" fileref="diagrams/static.pdf"/>
      </imageobject>
     </mediaobject>
    </figure>
   </para>


Paul A. Hoadley wrote:DocBook XSL Stylesheets 1.68.1

You will need to replace fo/graphics.xsl with the current version from
CVS---this functionality only works post-1.68.1.


The odd thing is that the updated fo/graphics.xsl appears to require that img.src.path be defined. I simply set this to "'./'", but I wonder if this isn't a bug in the CVS stylesheet.

-David

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 3 guests