Re[2]: [xep-support] Another image scaling question

From: Alexander Peshkov (peshkov@renderx.com)
Date: Fri May 07 2004 - 07:51:54 PDT

  • Next message: Chen, Cindy (C)(STP): "RE: Re[2]: [xep-support] Another image scaling question"

    Hello Cindy,

    We are hitting one obscure limitation of XEP here. When image height
    is specified as a percentage, XEP calculates actual number using width
    as a base. This limitation should be described in our documentation -
    we will add appropriate note in the next version. As a workaround you
    can set height equal to the real height of the page (in your example
    it is '150mm').

    Note that you should specify text/display-align on the fo:block, not
    on the fo:external-graphic element. You also have to remove border
    from fo:region-body since it also requires some space (or specify
    image height as page-height minus border-width).

    This is modified version of your example:

    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
         <fo:layout-master-set>
             <fo:simple-page-master page-width="110mm" page-height="150mm" master-name="sample">
                 <fo:region-body region-name="xsl-region-body"/>
             </fo:simple-page-master>
         </fo:layout-master-set>
         <fo:page-sequence master-reference="sample">
             <fo:flow flow-name="xsl-region-body">
                 <fo:block display-align="center" text-align="center" line-height="0pt">
                     <fo:external-graphic src="url(Images/spots.jpg)"
                         content-width="scale-to-fit"
                         width="100%"
                         content-height="scale-to-fit"
                         height="150mm"/>
                 </fo:block>
             </fo:flow>
         </fo:page-sequence>
    </fo:root>

    Sorry for inconvenience.

    Best regards,
    Alexander Peshkov mailto:peshkov@renderx.com
    RenderX

    CCCS> Hi Alexander,

    CCCS> I have tried to set line-height="0pt" on the block, I am still getting the error stating:
    CCCS> [warning] no space for an element, trying to recover

    CCCS> As a result, I am still not seeing the image on the result. My changed code is attatched.

    CCCS> BTW, I am running XEP 3.7.5.

    CCCS> Thanks,
    CCCS> Cindy

    CCCS> -----Original Message-----
    CCCS> From: Alexander Peshkov [mailto:peshkov@renderx.com]
    CCCS> Sent: Thursday, May 06, 2004 4:28 AM
    CCCS> To: Chen, Cindy (C)(STP)
    CCCS> Subject: Re: [xep-support] Another image scaling question

    CCCS> Hello Cindy,

    CCCS> In cases when image is taller than available space and vertical
    CCCS> scaling is performed you get an overflow. The reason is simple:
    CCCS> height="100%" means "as high as parent reference area content
    CCCS> rectangle", however fo:external-graphic is an inline-level element and
    CCCS> thus preceded and followed by empty-space known as half-leading. As a
    CCCS> result the whole content is higher then available space and XEP drops
    CCCS> overflowed image. In order to fix this problem you can simply set
    CCCS> line-height="0pt" on the block that enclose image.

    CCCS> Best regards,
    CCCS> Alexander Peshkov mailto:peshkov@renderx.com
    CCCS> RenderX

    CCCS>> Hi all,

    CCCS>> I have another question regarding image scaling. I am trying to scale and place an image into one page. So I defined FO like following:
    CCCS>> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    CCCS>> <fo:layout-master-set>
    CCCS>> <fo:simple-page-master page-width="110mm" page-height="150mm" master-name="sample">
    CCCS>> <fo:region-body border="solid" region-name="xsl-region-body"/>
    CCCS>> </fo:simple-page-master>
    CCCS>> </fo:layout-master-set>
    CCCS>> <fo:page-sequence master-reference="sample">
    CCCS>> <fo:flow flow-name="xsl-region-body">
    CCCS>> <fo:block>
    CCCS>> <fo:external-graphic src="url(Images/spots.jpg)" display-align="center" text-align="center"
    CCCS>> content-width="scale-to-fit" width="100%" content-height="scale-to-fit" height="100%"/>
    CCCS>> </fo:block>
    CCCS>> </fo:flow>
    CCCS>> </fo:page-sequence>
    CCCS>> </fo:root>

    CCCS>> It worked fine as I expected. But one thing is that if I make the page width bigger than page height, I got an error stating:
    CCCS>> [warning] no space for an element, trying to recover

    CCCS>> Following is the two cases that will both cause the error:
    CCCS>> <fo:simple-page-master page-width="110mm" page-height="150mm" master-name="sample" reference-orientation="90">
    CCCS>> <fo:simple-page-master page-width="150mm" page-height="110mm" master-name="sample">

    CCCS>> The image I am using is the one comes with the XEP sample code.

    CCCS>> How could I avoid the error?

    CCCS>> Thanks,
    CCCS>> Cindy Chen

    CCCS>> -------------------
    CCCS>> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    CCCS>> in the body of the message to majordomo@renderx.com from the address
    CCCS>> you are subscribed from.
    CCCS>> (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html

    CCCS> -------------------
    CCCS> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    CCCS> in the body of the message to majordomo@renderx.com from the address
    CCCS> you are subscribed from.
    CCCS> (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html

    -------------------
    (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    in the body of the message to majordomo@renderx.com from the address
    you are subscribed from.
    (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



    This archive was generated by hypermail 2.1.5 : Fri May 07 2004 - 08:02:22 PDT