You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Murray Cumming <mu...@murrayc.com> on 2009/09/18 17:28:38 UTC

DocBook to PDF: Using scalefit to fit images on the page?

I'm generating PDF from Docbook with fop. 
I have tried to follow the advice here 
http://www.sagehill.net/docbookxsl/ImageSizing.html
to make my images scale to fit the page size, but I've had no luck so
far.

I've tried various combinations of relevant attributes on the imagedata
tag, including:
 scalefit="1" contentdepth="100%" contentwidth="100%" width="100%"
but the wider images are always cut at the right of the page.

Can anyone suggest what I'm doing wrong or if there is a particular bug
that's causing this. I'd rather not hard-code the image dimensions into
the .XML file because I would forget to update the XML when I update
the .png file one day.


I'm using fop on Fedora 11, which otherwise seems to work very well. It
has fop 0.95. I'm using the latest DocBook XSL stylesheets from
http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl

I suspect that I need the "Graphic size extension" mentioned at 
http://www.sagehill.net/docbookxsl/ImageSizing.html
but that can't apparently be used with fop:
http://docbook.sourceforge.net/release/xsl/current/extensions/


This is an example of the DocBook markup I'm using for images:

<figure id="figure-starting-new">
  <title>Starting a new <literal>Manager</literal> and
<literal>Worker</literal></title>
  <screenshot>
    <mediaobject>
      <imageobject>
        <imagedata format="PNG"
fileref="figures/sshot-connection-startnew.png"/></imageobject></mediaobject>123         </screenshot>
</figure>

Here's the actual DocBook XML:
https://code.fluendo.com/flumotion/trac/browser/flumotion-doc/trunk/doc/manual/C/flumotion-manual.xml#L119



-- 
murrayc@murrayc.com
www.murrayc.com
www.openismus.com


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: DocBook to PDF: Using scalefit to fit images on the page?

Posted by Murray Cumming <mu...@murrayc.com>.
On Fri, 2009-09-18 at 17:28 +0200, Murray Cumming wrote:
> I'm generating PDF from Docbook with fop. 
> I have tried to follow the advice here 
> http://www.sagehill.net/docbookxsl/ImageSizing.html
> to make my images scale to fit the page size, but I've had no luck so
> far.
> 
> I've tried various combinations of relevant attributes on the imagedata
> tag, including:
>  scalefit="1" contentdepth="100%" contentwidth="100%" width="100%"
> but the wider images are always cut at the right of the page.

Sorry, when I tried to create a simple test case I realized that I was
not really changing the markup that I thought I was changing. In fact it
works fine if I use this on the imagedata:
  scalefit="1" width="100%"
as per that documentation.

-- 
murrayc@murrayc.com
www.murrayc.com
www.openismus.com


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org