This is one I have been battling (as a self-taught to novice Docbook user), for 
some time. I was trying to find a common solution for block and inline images. 
What worked in Docbook 4 did not necessarily work after upgrading to Docbook 5. 
Two mins after documenting my solution for my team, your mail came in.

I tried all sorts of combinations of attributes and xsl styling. I ended up 
removing nearly all the image sizing content in our customisation layer and 
settled on this.

For an image that is too wide, add scalefit="1" and contentwidth="100%" 
attributes to the <imagegedata> tag: e.g

        <imagedata fileref="images/excel_ccode.png"/>


        <imagedata scalefit="1" width="100%" fileref="images/excel_ccode.png"/>

2 For an image that is too high to fit onto a page, add scalefit="1" and 
contentwidth="100%" attributes to the <imagegedata> tag

For inline media objects, I just resize them in an image editor – don’t know if 
this is practical in your case though.

There may be other considerations depending on your build tool chain.

I am sure that experts will have a much more sophisticated customisation layer 
solution, but this is simple, works for me and I can easily roll out to the 
rest of my team. I do look forward to seeing solutions from more expert users.

I’d love to get some feedback.


From: Paul Baumer []
Sent: 17 October 2016 03:29 PM
Subject: [docbook] Scale Image to fit in width or leave unscaled


I would like to achieve the following image resizing as a general rule in my 
docbook5. I generate the docbook myself using python. And finally I generate 
pdf from the docbook.

if image width will not fit the page
   it shall be resized to fit in width
   image size shall be left unchanged

I am aware of the scalefit, scale, width and content width. But I am having 
difficulty in using a combination of those to achieve the desired logic above.

All emails in this message string and any attachments are the confidential 
information of CSG Systems International, Inc. (CSG), or its affiliates and 
subsidiaries, and may contain privileged and/or confidential material. If you 
are not an intended recipient, please delete it immediately and notify the 
sender; unintended recipients are not authorized to read or otherwise use the 
information contained herein.

Reply via email to